def METHOD_NAME(v):
    if isinstance(v, bool):
        return v
    if isinstance(v, str):
        v_lower = v.lower()
        if v_lower in ('yes', 'true', 'y', '1'):
            return True
        elif v_lower in ('no', 'false', 'n', '0'):
            return False
    raise argparse.ArgumentTypeError('Boolean value or its string '
                                     'representation expected.')