from pathlib import Path


def expand_path(path):
    """Performs `ls` like operation.
    Lists contents in a folder if path is a folder.
    Expands wildcard if path contains wildcard in its name part."""
    path = Path(path)
    d, n = path.parent, path.name
    return list(Path(d).glob(n))