import inspect


def _get_loader_details(hook) -> tuple:
    """Return the loader_details for a given FileFinder closure

    :param hook: FileFinder closure
    :returns: loader_details tuple
    """
    try:
        namespace = inspect.getclosurevars(hook)
    except TypeError as err:
        raise ValueError from err

    try:
        return namespace.nonlocals["loader_details"]
    except KeyError as err:
        raise ValueError from err