code: def _request(self, endpoint, method, data=None, **kwargs):
          
          final_url = self.url + endpoint
  
          if not self._is_authenticated:
              raise LoginRequired
  
          rq = self.session
          if method == 'get':
              request = rq.get(final_url, **kwargs)
          else:
              request = rq.post(final_url, data, **kwargs)
  
          request.raise_for_status()
          request.encoding = 'utf_8'
  
          if len(request.text) == 0:
              data = json.loads('{}')
          else:
              try:
                  data = json.loads(request.text)
              except ValueError:
                  data = request.text
  
          return data
docs: Method to hanle both GET and POST requests.
  
          :param endpoint: Endpoint of the API.
          :param method: Method of HTTP request.
          :param data: POST DATA for the request.
          :param kwargs: Other keyword arguments.
  
          :return: Response for the request.