def file_in_cache(path: str, max_age: int = 0) -> bool:
    """
    Check if a file exists in the local cache
    """

    # Get directory
    directory = os.path.dirname(path)

    # Make sure the cache directory exists
    if not os.path.exists(directory):
        try:
            os.makedirs(directory)
        except FileExistsError:
            pass

    # Return the file path if it exists
    if os.path.isfile(path) and time.time() - os.path.getmtime(path) <= max_age:
        return True

    return False

    Check if a file exists in the local cache
    
meteostat/core/cache.py