'Handles checking if the user should be throttled.
Mostly a hook, this uses class assigned to ``throttle`` from
``Resource._meta``.'

def throttle_check(self, request):

    identifier = self._meta.authentication.get_identifier(request)
    throttle = self._meta.throttle.should_be_throttled(identifier)
    if throttle:
        response = http.HttpTooManyRequests()
        if (isinstance(throttle, int) and (not isinstance(throttle, bool))):
            response[u'Retry-After'] = throttle
        elif isinstance(throttle, datetime):
            response[u'Retry-After'] = format_date_time(mktime(throttle.timetuple()))
        raise ImmediateHttpResponse(response=response)
