Given a version specification. It can be any dict which is returned
    verbatim, an index into :data:`PY_INTERNALS` or ``None``.

    Arguments:
        version: The python version to return the internals of.
        default: The python version that will be looked up if ``version`` is
            None.

    Returns:
        dict: The python internals for the requested version.

def get_py_internals(version=None, default=None):
    """
    Given a version specification. It can be any dict which is returned
    verbatim, an index into :data:`PY_INTERNALS` or ``None``.

    Arguments:
        version: The python version to return the internals of.
        default: The python version that will be looked up if ``version`` is
            None.

    Returns:
        dict: The python internals for the requested version.
    """

    if version is None:
        version = default

    if isinstance(version, dict):
        return version
    elif version in PY_INTERNALS:
        return PY_INTERNALS[version]
    else:
        return ValueError('Unsupported python version %r requested.' % version)