from pathlib import Path


def expand_paths(path_expr):
    """Given a path expression, return a list of paths."""
    path = Path(path_expr).expanduser()
    if path.is_file():
        return [path]
    return Path(path.root).glob(
        str(Path("").joinpath(*path.parts[1:] if path.is_absolute() else path.parts))
    )