code: def request(self, method, resource, all_pages=False, **kwargs):
          
          response = self.raw_request(method, resource, **kwargs)
  
          if not is_valid_response(response):
              raise GitHubError(response)
  
          if is_json_response(response):
              result = response.json()
              while all_pages and response.links.get('next'):
                  url = response.links['next']['url']
                  response = self.raw_request(method, url, **kwargs)
                  if not is_valid_response(response) or \
                          not is_json_response(response):
                      raise GitHubError(response)
                  body = response.json()
                  if isinstance(body, list):
                      result += body
                  elif isinstance(body, dict) and 'items' in body:
                      result['items'] += body['items']
                  else:
                      raise GitHubError(response)
              return result
          else:
              return response
docs: Makes a request to the given endpoint.
          Keyword arguments are passed to the :meth:`~requests.request` method.
          If the content type of the response is JSON, it will be decoded
          automatically and a dictionary will be returned.
          Otherwise the :class:`~requests.Response` object is returned.