code: def login(self, user, passwd):
          
          def do_login(self, user, passwd, token=None):
              """
              Login function that handles CSRF protection (see `MediaWiki bug
              23076`_). Returns ``True`` on successful login.
  
              .. _`MediaWiki bug 23076`:
                  https://bugzilla.wikimedia.org/show_bug.cgi?id=23076
              """
              data = {'action': 'login',
                      'lgname': user,
                      'lgpassword': passwd}
              if token:
                  data['lgtoken'] = token
              result = self.call(data)
              if result['login']['result'] == 'Success':
                  self._high_limits = None
                  return True
              elif result['login']['result'] == 'NeedToken' and not token:
                  return do_login(self, user, passwd, result['login']['token'])
              else:
                  return False
  
          return do_login(self, user, passwd)
docs: Logs into the wiki with username *user* and password *passwd*. Returns
          ``True`` on successful login.
  
          :param user: username
          :param passwd: password
          :returns: ``True`` on successful login, otherwise ``False``