def METHOD_NAME(regmapdir):
    """check for a valid regmap directory in debugfs"""
    if not os.path.isdir(regmapdir):
        msg = f"{regmapdir} is not a valid directory"
        raise argparse.ArgumentTypeError(msg)
    range_path = os.path.join(regmapdir, 'range')
    if not os.path.isfile(range_path):
        msg = f"{range_path} is not a valid file"
        raise argparse.ArgumentTypeError(msg)
    registers_path = os.path.join(regmapdir, 'registers')
    if not os.path.isfile(registers_path):
        msg = f"{registers_path} is not a valid file"
        raise argparse.ArgumentTypeError(msg)
    return regmapdir