def qtconsole_cmd(kernel):
    """Compute the command to connect a qt console to an already running kernel
    """
    ports = ['--%s=%d' % (name, port) for name, port in kernel.ports.items()]
    return ['ipython', 'qtconsole', '--existing'] + ports