import re


def mountpoint_dataset(mountpoint: str):
    """
    Check if dataset is a 'zfs' mount.
    return dataset, or None if not found
    """

    target = re.compile(r'^.*\s+' + mountpoint + r'\s+zfs\b')

    with open("/proc/mounts") as f:
        mount = next((ds for ds in f.read().splitlines() if target.search(ds)), None)

    return None if mount is None else mount.split()[0]