code: def connect(
              self, login, password, authz_id=b"", starttls=False,
              authmech=None):
          
          try:
              self.sock = socket.create_connection((self.srvaddr, self.srvport))
              self.sock.settimeout(Client.read_timeout)
          except socket.error as msg:
              raise Error("Connection to server failed: %s" % str(msg))
  
          if not self.__get_capabilities():
              raise Error("Failed to read capabilities from server")
          if starttls and not self.__starttls():
              return False
          if self.__authenticate(login, password, authz_id, authmech):
              return True
          return False
docs: Establish a connection with the server.
  
          This function must be used. It read the server capabilities
          and wraps calls to STARTTLS and AUTHENTICATE commands.
  
          :param login: username
          :param password: clear password
          :param starttls: use a TLS connection or not
          :param authmech: prefered authenticate mechanism
          :rtype: boolean