def login(self, username, password):
        """
        Log in to the server.

        If APOP is available it will be used.  Otherwise, if TLS is
        available, an encrypted session will be started and plaintext
        login will proceed.  Otherwise, if L{allowInsecureLogin} is set,
        insecure plaintext login will proceed.  Otherwise,
        L{InsecureAuthenticationDisallowed} will be raised.

        The first step of logging into the server is obtaining the server's
        capabilities.  When that is complete, the L{_login} callback function
        continues the login process.

        @type username: L{bytes}
        @param username: The username with which to log in.

        @type password: L{bytes}
        @param password: The password with which to log in.

        @rtype: L{Deferred <defer.Deferred>} which successfully fires with
            L{bytes}
        @return: A deferred which fires when the login process is complete.
            On a successful login, it returns the server's response minus the
            status indicator.
        """
        d = self.capabilities()
        d.addCallback(self._login, username, password)
        return d

        Log in to the server.

        If APOP is available it will be used.  Otherwise, if TLS is
        available, an encrypted session will be started and plaintext
        login will proceed.  Otherwise, if L{allowInsecureLogin} is set,
        insecure plaintext login will proceed.  Otherwise,
        L{InsecureAuthenticationDisallowed} will be raised.

        The first step of logging into the server is obtaining the server's
        capabilities.  When that is complete, the L{_login} callback function
        continues the login process.

        @type username: L{bytes}
        @param username: The username with which to log in.

        @type password: L{bytes}
        @param password: The password with which to log in.

        @rtype: L{Deferred <defer.Deferred>} which successfully fires with
            L{bytes}
        @return: A deferred which fires when the login process is complete.
            On a successful login, it returns the server's response minus the
            status indicator.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/pop3client.py