code: def _api_call(self, endpoint, model=None, method=None, data=None, filters=None):
          if not self.token:
              raise RuntimeError("You do not have an API token!")
          if not method:
              raise ValueError("Method is required for API calls!")
          if model:
              endpoint = endpoint.format(**vars(model))
          url = '{}{}'.format(self.base_url, endpoint)
          headers = {
              'Authorization': "Bearer {}".format(self.token),
              'Content-Type': 'application/json',
              'User-Agent': self._user_agent,
          }
          if filters:
              headers['X-Filter'] = json.dumps(filters)
          body = None
          if data is not None:
              body = json.dumps(data)
          response = method(url, headers=headers, data=body)
          warning = response.headers.get('Warning', None)
          if warning:
              logger.warning('Received warning from server: {}'.format(warning))
          if 399 < response.status_code < 600:
              j = None
              error_msg = '{}: '.format(response.status_code)
              try:
                  j = response.json()
                  if 'errors' in j.keys():
                      for e in j['errors']:
                          error_msg += '{}; '.format(e['reason']) \
                                  if 'reason' in e.keys() else ''
              except:
                  pass
              raise ApiError(error_msg, status=response.status_code, json=j)
          if response.status_code != 204:
              j = response.json()
          else:
              j = None
          return j