def has_matplotlib(version='1.2'):
 try:
  import matplotlib
 except Exception:
  has_mpl = False
 else:
  if (LooseVersion(matplotlib.__version__) >= LooseVersion(version)):
   has_mpl = True
  else:
   has_mpl = False
 return has_mpl

def has_matplotlib ( version = '1.2' ) : try : import matplotlib except Exception : has_mpl = False else : if ( LooseVersion ( matplotlib . __version__ ) >= LooseVersion ( version ) ) : has_mpl = True else : has_mpl = False return has_mpl
determine if mpl is a usable version .