def profile_dir(name):
    """Return path to FF profile for a given profile name or path."""
    if name:
        possible_path = Path(name)
        if possible_path.exists():
            return possible_path
    profiles = list(read_profiles())
    try:
        if name:
            profile = next(p for p in profiles if p.name == name)
        else:
            profile = next(p for p in profiles if p.default)
    except StopIteration:
        raise ProfileNotFoundError(name)
    return profile.path
Return path to FF profile for a given profile name or path.