def tokenize_url_path(url, baseurl='https://api.pagerduty.com'):
    """
    Classifies a URL according to some global patterns in the API.

    If the URL is to access a specific individual resource by ID, the node type
    will be identified as ``{id}``, whereas if it is an index, it will be
    identified as ``{index}``.

    For instance, ``https://api.pagerduty.com/users`` would be classified as
    ``("users", "{index}")``, and ``https://api.pagerduty.com/users/PABC123``
    would be classified as ``("users", "{id}")``

    :param url:
        The URL (or path) to be classified; the function should accept either
    :param baseurl:
        API base URL
    :type method: str
    :type url: str
    :type baseurl: str
    :rtype: tuple 
    """
    urlnparams = url.split('#')[0].split('?')
    url_nodes = urlnparams[0].lstrip('/').split('/')
    path_index = 0
    invalid_url = ValueError('Invalid API resource URL: ' + url[:99])
    if url.startswith(baseurl):
        path_index = 3
    elif url.startswith('http') and url_nodes[0].endswith(':'):
        raise invalid_url
    if len(url_nodes) - path_index < 1:
        raise invalid_url
    path_nodes = tuple(url_nodes[path_index:])
    if '' in path_nodes:
        raise invalid_url
    tokenized_nodes = [path_nodes[0]]
    if len(path_nodes) >= 3:
        tokenized_nodes.extend(('{id}', path_nodes[2]))
    final_node_type = '{id}'
    if len(path_nodes) % 2 == 1:
        final_node_type = '{index}'
    tokenized_nodes.append(final_node_type)
    return tuple(tokenized_nodes)
