<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def launch_ipython(argv=None, ipython_app=None):
 """ Launch IPython from this interpreter with custom args if needed. Chimera magic commands are also enabled automatically. """

    try:
        if ipython_app is None:
            from IPython.terminal.ipapp import TerminalIPythonApp as ipython_app
        from traitlets.config import Config
    except ImportError:
        sys.exit("ERROR: IPython not installed in this environment. "
                 "Try with `conda install ipython`")
    else:
        # launch_new_instance(argv)
        app = ipython_app()
        c = Config()
        code = ["from pychimera import enable_chimera_inline",
                "enable_chimera_inline()"]
        c.InteractiveShellApp.exec_lines = code
        app.update_config(c)
        app.initialize(argv)
        app.start()