code: def login(self, username, password, login_token=None):
          
          if login_token is None:
              token_doc = self.post(action='query', meta='tokens', type='login')
              login_token = token_doc['query']['tokens']['logintoken']
  
          login_doc = self.post(
              action="clientlogin", username=username, password=password,
              logintoken=login_token, loginreturnurl="http://example.org/")
  
          if login_doc['clientlogin']['status'] == "UI":
              raise ClientInteractionRequest.from_doc(
                  login_token, login_doc['clientlogin'])
          elif login_doc['clientlogin']['status'] != 'PASS':
              raise LoginError.from_doc(login_doc['clientlogin'])
          return login_doc['clientlogin']
docs: Authenticate with the given credentials.  If authentication is
          successful, all further requests sent will be signed the authenticated
          user.
  
          Note that passwords are sent as plaintext. This is a limitation of the
          Mediawiki API.  Use a https host if you want your password to be secure
  
          :Parameters:
              username : str
                  The username of the user to be authenticated
              password : str
                  The password of the user to be authenticated
  
          :Raises:
              :class:`mwapi.errors.LoginError` : if authentication fails
              :class:`mwapi.errors.ClientInteractionRequest` : if authentication requires a continue_login() call
              :class:`mwapi.errors.APIError` : if the API responds with an error