def str2bool(v):
    """Used in argparse.ArgumentParser.add_argument to indicate
    that a type is a bool type and user can enter

        - yes, true, t, y, 1, to represent True
        - no, false, f, n, 0, to represent False

    See https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse  # noqa
    """
    if isinstance(v, bool):
        return v
    if v.lower() in ("yes", "true", "t", "y", "1"):
        return True
    elif v.lower() in ("no", "false", "f", "n", "0"):
        return False
    else:
        raise argparse.ArgumentTypeError("Boolean value expected.")
Used in argparse.ArgumentParser.add_argument to indicate
that a type is a bool type and user can enter

- yes, true, t, y, 1, to represent True
- no, false, f, n, 0, to represent False

See https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse  # noqa
utils/util.py