def connect_qtconsole(connection_file=None, argv=None, profile=None):
argv = [] if argv is None else argv<EOL>if connection_file is None:<EOL><INDENT>cf = get_connection_file()<EOL><DEDENT>else:<EOL><INDENT>cf = find_connection_file(connection_file, profile=profile)<EOL><DEDENT>cmd = '<STR_LIT:;>'.join([<EOL>"<STR_LIT>",<EOL>"<STR_LIT>"<EOL>])<EOL>return Popen([sys.executable, '<STR_LIT:-c>', cmd, '<STR_LIT>', cf] + argv, stdout=PIPE, stderr=PIPE)<EOL>
Connect a qtconsole to the current kernel.

    This is useful for connecting a second qtconsole to a kernel, or to a
    local notebook.

    Parameters
    ----------
    connection_file : str [optional]
        The connection file to be used. Can be given by absolute path, or
        IPython will search in the security directory of a given profile.
        If run from IPython, 

        If unspecified, the connection file for the currently running
        IPython Kernel will be used, which is only allowed from inside a kernel.
    argv : list [optional]
        Any extra args to be passed to the console.
    profile : str [optional]
        The name of the profile to use when searching for the connection file,
        if different from the current IPython session or 'default'.


    Returns
    -------
    subprocess.Popen instance running the qtconsole frontend