def METHOD_NAME(self, path, data=None, headers=None, url=None, method='GET', count=0):
    """Function for performing the trakt request."""
    if not self.access_token and count >= 2:
        raise MissingTokenException(u'You must get a Trakt TOKEN. Check your Trakt settings')
    if headers is None:
        headers = self.headers
    if self.access_token:
        headers['Authorization'] = 'Bearer ' + self.access_token
    if url is None:
        url = self.api_url
    count += 1
    data = json.dumps(data) if data else []
    try:
        resp = self.session.METHOD_NAME(method, url + path, headers=headers, timeout=self.timeout,
                                    data=data, verify=self.ssl_verify)
        # check for http errors and raise if any are present
        resp.raise_for_status()
        # convert response to json
        resp = resp.json()
    except requests.RequestException as e:
        code = getattr(e.response, 'status_code', None)
        if code == 502:
            # Retry the request, cloudflare had a proxying issue
            log.debug(u'Retrying trakt api request: {0} (attempt: {1})'.format(path, count))
            return self.METHOD_NAME(path, data, headers, url, method, count=count)
        elif code == 401:
            if self.get_token(refresh_token=True, count=count):
                return self.METHOD_NAME(path, data, headers, url, method)
            else:
                log_message = u'Unauthorized. Please check your Trakt settings'
                log.warning(log_message)
                raise AuthException(log_message)
        elif code in (None, 500, 501, 503, 504, 520, 521, 522):
            # Report Trakt as unavailable when Timeout to connect (no status code)
            # http://docs.trakt.apiary.io/#introduction/status-codes
            raise UnavailableException(u"Trakt may have some issues and it's unavailable. Try again later please")
        elif code == 404:
            log_message = u'Trakt error (404) Not found - the resource does not exist: {0}'.format(url + path)
            log.error(log_message)
            raise ResourceUnavailable(log_message)
        elif code == 410:
            log_message = u'Trakt error (410) Expired - the tokens have expired. Get a new one'
            log.warning(log_message)
            raise TokenExpiredException(log_message)
        elif code == 413:
            # Cause of error unknown - https://github.com/pymedusa/Medusa/issues/4090
            log_message = u'Trakt error (413) Request Entity Too Large for url {0}'.format(url + path)
            log.warning(log_message)
            # Dumping data for debugging purposes
            log.debug(u'Trakt request headers:\n{0}'.format(e.METHOD_NAME.headers))
            log.debug(u'Trakt request body:\n{0}'.format(e.METHOD_NAME.body))
            log.debug(u'Trakt response headers:\n{0}'.format(e.response.headers))
            log.debug(u'Trakt response body:\n{0}'.format(e.response.body))
            raise TraktException(log_message)
        else:
            log_message = u'Unknown Trakt request exception. Error: {0}'.format(code or e)
            log.error(log_message)
            raise TraktException(log_message)
    # check and confirm trakt call did not fail
    if isinstance(resp, dict) and resp.get('status', False) == 'failure':
        if 'message' in resp:
            raise TraktException(resp['message'])
        if 'error' in resp:
            raise TraktException(resp['error'])
        else:
            raise TraktException('Unknown Error')
    # If it got this far, the access token should be correct. It could be the access token
    # has been refreshed in the mean time.
    return resp