def METHOD_NAME(storage) -> str:
    """Extracts the underlying path from a given storage."""
    from deeplake.core.storage.lru_cache import LRUCache
    if isinstance(storage, LRUCache):
        return METHOD_NAME(storage.next_storage)
    elif isinstance(storage, StorageProvider):
        if hasattr(storage, "hub_path"):
            return storage.hub_path  # type: ignore
        return storage.root
    else:
        raise ValueError("Invalid storage type.")