code: def open(self):
          
          # Short-circuit
          if self.is_connected:
              return
          err = "Refusing to be ambiguous: connect() kwarg '{}' was given both via regular arg and via connect_kwargs!"  # noqa
          # These may not be given, period
          for key in """
              hostname
              port
              username
          """.split():
              if key in self.connect_kwargs:
                  raise ValueError(err.format(key))
          # These may be given one way or the other, but not both
          if (
              "timeout" in self.connect_kwargs
              and self.connect_timeout is not None
          ):
              raise ValueError(err.format("timeout"))
          # No conflicts -> merge 'em together
          kwargs = dict(
              self.connect_kwargs,
              username=self.user,
              hostname=self.host,
              port=self.port,
          )
          if self.gateway:
              kwargs["sock"] = self.open_gateway()
          if self.connect_timeout:
              kwargs["timeout"] = self.connect_timeout
          # Strip out empty defaults for less noisy debugging
          if "key_filename" in kwargs and not kwargs["key_filename"]:
              del kwargs["key_filename"]
          # Actually connect!
          self.client.connect(**kwargs)
          self.transport = self.client.get_transport()
docs: Initiate an SSH connection to the host/port this object is bound to.
  
          This may include activating the configured gateway connection, if one
          is set.
  
          Also saves a handle to the now-set Transport object for easier access.
  
          Various connect-time settings (and/or their corresponding :ref:`SSH
          config options <ssh-config>`) are utilized here in the call to
          `SSHClient.connect <paramiko.client.SSHClient.connect>`. (For details,
          see :doc:`the configuration docs </concepts/configuration>`.)
  
          .. versionadded:: 2.0