Returns the sorting key for an extension.

    The sorting key can be used to sort a list of extensions
    into the order that is used in the Khronos C OpenGL headers.
    :param Extension extension: Extension to produce sort key for
    :returns: A sorting key

def extension_sort_key(extension):
    """Returns the sorting key for an extension.

    The sorting key can be used to sort a list of extensions
    into the order that is used in the Khronos C OpenGL headers.
    :param Extension extension: Extension to produce sort key for
    :returns: A sorting key
    """
    name = extension.name
    category = name.split('_', 2)[1]
    return (0, name) if category in ('ARB', 'KHR', 'OES') else (1, name)