1#!/usr/bin/env python3
 2
 3"""Safely import matplotlib on AIX machines.
 4This module must be imported before matlpotlib otherwise we get a runtime
 5exception on AIX with no X connection available."""
 6
 7import sys
 8
 9# (module level import not at top of file)
10# pep8: disable=E402
11if 'matplotlib' not in sys.modules:
12    # Force Numpy to use `Agg` backend.
13    # This throws an error if done after another module has imported numpy
14    import matplotlib
15    matplotlib.use('Agg')