import re


def parse_keyslots_luks1(luks_dump):
    """Lists the used keyslots in a LUKS1 device. These may or may not be
    bound to clevis.
    Return: <used keyslots> <error>"""

    if not luks_dump:
        return None, {"msg": "Empty dump provided"}

    # This is the pattern we are looking for:
    # Key Slot 0: ENABLED
    pattern = r"^Key Slot\s(\d+): ENABLED$"
    match = re.findall(pattern, luks_dump, re.MULTILINE)
    if not match:
        errmsg = "parse_keyslots_luks1: no used key slots"
        return (None, {"msg": errmsg})

    return match, None