from pathlib import Path


def corpus_file(path):
    """
    Get a data file from a standard location. Check a few possible locations until the file is
    found.
    """
    my_location = Path(__file__).parent
    root_location = my_location.parent
    nfs_location = Path('/nfs/mg-cache/language_id/corpus')
    paths_to_try = [root_location / 'corpus', nfs_location]
    for location in paths_to_try:
        path_to_try = location / path
        if path_to_try.exists():
            return str(path_to_try)

    raise FileNotFoundError(f"Can't find {path!r} in any of {paths_to_try!r}")