#NEWLINE# def find_gui_and_backend( gui = None ) : #NEWLINE# #INDENT# "Given a gui string return the gui and mpl backend.\n\n    Parameters\n    ----------\n    gui : str\n        Can be one of ('tk','gtk','wx','qt','qt4','inline').\n\n    Returns\n    -------\n    A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',\n    'WXAgg','Qt4Agg','module://IPython.zmq.pylab.backend_inline').\n    " #NEWLINE# import matplotlib #NEWLINE# if gui : #NEWLINE# #INDENT# backend = backends [ gui ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# backend = matplotlib . rcParams [ 'backend' ] #NEWLINE# gui = backend2gui . get ( gui , None ) #NEWLINE# #UNINDENT# return ( gui , backend )