def get_ufa_repo_by_dir(filepath):
    """ Reads .ufarepo file and returns root repository """
    path_list = filepath.split('/')
    path_list.append('.ufarepo')
    ufarepo_path = "/".join(path_list)
    try:
        with open(ufarepo_path, "r") as f:
            return f.readline().strip()
    except FileNotFoundError:
        return None