'Take a fully qualified URL and attempts to return the rate limit
resource family corresponding to it. For example:
>>> RateLimit.url_to_resource(\'https://api.twitter.com/1.1/statuses/lookup.json?id=317\')
>>> \'/statuses/lookup\'
Args:
url (str): URL to convert to a resource family.
Returns:
string: Resource family corresponding to the URL.'

@staticmethod
def url_to_resource(url):

    resource = urlparse(url).path.replace('/1.1', '').replace('.json', '')
    for non_std_endpoint in NON_STANDARD_ENDPOINTS:
        if re.match(non_std_endpoint.regex, resource):
            return non_std_endpoint.resource
    else:
        return resource
