'Opens a new Telnet connection to the given host and port.
The ``timeout``, ``newline``, ``prompt``, ``prompt_is_regexp``,
``encoding``, ``default_log_level``, ``window_size``, ``environ_user``,
``terminal_emulation``, ``terminal_type`` and ``telnetlib_log_level``
arguments get default values when the library is [#Importing|imported].
Setting them here overrides those values for the opened connection.
See `Configuration`, `Terminal emulation` and `Logging` sections for
more information about these parameters and their possible values.
Possible already opened connections are cached and it is possible to
switch back to them using `Switch Connection` keyword. It is possible to
switch either using explicitly given ``alias`` or using index returned
by this keyword. Indexing starts from 1 and is reset back to it by
`Close All Connections` keyword.'

def open_connection(self, host, alias=None, port=23, timeout=None, newline=None, prompt=None, prompt_is_regexp=False, encoding=None, encoding_errors=None, default_log_level=None, window_size=None, environ_user=None, terminal_emulation=None, terminal_type=None, telnetlib_log_level=None, connection_timeout=None):

    timeout = (timeout or self._timeout)
    connection_timeout = (timestr_to_secs(connection_timeout) if connection_timeout else self._connection_timeout)
    newline = (newline or self._newline)
    encoding = (encoding or self._encoding)
    encoding_errors = (encoding_errors or self._encoding_errors)
    default_log_level = (default_log_level or self._default_log_level)
    window_size = self._parse_window_size((window_size or self._window_size))
    environ_user = (environ_user or self._environ_user)
    if (terminal_emulation is None):
        terminal_emulation = self._terminal_emulation
    terminal_type = (terminal_type or self._terminal_type)
    telnetlib_log_level = (telnetlib_log_level or self._telnetlib_log_level)
    if (not prompt):
        (prompt, prompt_is_regexp) = self._prompt
    logger.info(('Opening    connection    to    %s:%s    with    prompt:    %s%s' % (host, port, prompt, ('    (regexp)' if prompt_is_regexp else ''))))
    self._conn = self._get_connection(host, port, timeout, newline, prompt, is_truthy(prompt_is_regexp), encoding, encoding_errors, default_log_level, window_size, environ_user, is_truthy(terminal_emulation), terminal_type, telnetlib_log_level, connection_timeout)
    return self._cache.register(self._conn, alias)
