code: def login(self, user=None, password=None, restrict_login=None):
          if self.api_key:
              raise ValueError("cannot login when using an API key")
          if user:
              self.user = user
          if password:
              self.password = password
          if not self.user:
              raise ValueError("missing username")
          if not self.password:
              raise ValueError("missing password")
          if restrict_login:
              log.info("logging in with restrict_login=True")
          try:
              ret = self._login(self.user, self.password, restrict_login)
              self.password = ''
              log.info("login successful for user=%s", self.user)
              return ret
          except Fault as e:
              raise BugzillaError("Login failed: %s" % str(e.faultString))