async def connect(<EOL>host,<EOL>port=<NUM_LIT>,<EOL>version="<STR_LIT>",<EOL>on_event=None,<EOL>on_disconnect=None,<EOL>timeout=<NUM_LIT:5>,<EOL>loop=None,<EOL>) -> QRTConnection:
loop = loop or asyncio.get_event_loop()<EOL>try:<EOL><INDENT>_, protocol = await loop.create_connection(<EOL>lambda: QTMProtocol(<EOL>loop=loop, on_event=on_event, on_disconnect=on_disconnect<EOL>),<EOL>host,<EOL>port,<EOL>)<EOL><DEDENT>except (ConnectionRefusedError, TimeoutError, OSError) as exception:<EOL><INDENT>LOG.error(exception)<EOL>return None<EOL><DEDENT>try:<EOL><INDENT>await protocol.set_version(version)<EOL><DEDENT>except QRTCommandException as exception:<EOL><INDENT>LOG.error(Exception)<EOL>return None<EOL><DEDENT>except TypeError as exception:  <EOL><INDENT>LOG.error(exception)<EOL>return None<EOL><DEDENT>return QRTConnection(protocol, timeout=timeout)<EOL>
Async function to connect to QTM

    :param host: Address of the computer running QTM.
    :param port: Port number to connect to, should be the port configured for little endian.
    :param version: What version of the protocol to use, tested for 1.17 and above but could
        work with lower versions as well.
    :param on_disconnect: Function to be called when a disconnect from QTM occurs.
    :param on_event: Function to be called when there's an event from QTM.
    :param timeout: The default timeout time for calls to QTM.
    :param loop: Alternative event loop, will use asyncio default if None.

    :rtype: A :class:`.QRTConnection`