def configure_inline_support(shell, backend, user_ns=None):
<EOL>try:<EOL><INDENT>from IPython.zmq.pylab.backend_inline import InlineBackend<EOL><DEDENT>except ImportError:<EOL><INDENT>return<EOL><DEDENT>user_ns = shell.user_ns if user_ns is None else user_ns<EOL>cfg = InlineBackend.instance(config=shell.config)<EOL>cfg.shell = shell<EOL>if cfg not in shell.configurables:<EOL><INDENT>shell.configurables.append(cfg)<EOL><DEDENT>if backend == backends['<STR_LIT>']:<EOL><INDENT>from IPython.zmq.pylab.backend_inline import flush_figures<EOL>from matplotlib import pyplot<EOL>shell.register_post_execute(flush_figures)<EOL>pyplot.rcParams.update(cfg.rc)<EOL>user_ns['<STR_LIT>'] = pyplot.figsize = figsize<EOL><DEDENT>fmt = cfg.figure_format<EOL>select_figure_format(shell, fmt)<EOL>from IPython.core.display import display<EOL>user_ns['<STR_LIT>'] = display<EOL>user_ns['<STR_LIT>'] = getfigs<EOL>
Configure an IPython shell object for matplotlib use.

    Parameters
    ----------
    shell : InteractiveShell instance

    backend : matplotlib backend

    user_ns : dict
      A namespace where all configured variables will be placed.  If not given,
      the `user_ns` attribute of the shell object is used.