code: def set_token(self, token):
          
  
          if not token:
              self.token = None
              return
  
          expected_keys = ['token_type', 'refresh_token', 'access_token', 'scope', 'expires_in', 'expires_at']
          if not isinstance(token, dict) or not set(token) >= set(expected_keys):
              raise InvalidUsage("Expected a token dictionary containing the following keys: {0}"
                                 .format(expected_keys))
  
          # Set sanitized token
          self.token = dict((k, v) for k, v in token.items() if k in expected_keys)
docs: Validate and set token
  
          :param token: the token (dict) to set