def argparse_bool_type(option_string):
    """used to put into argparse add_argument(type=torchfun.bool),
    in order to parse bool switch values like:
    false False true True 0 1"""
    a = option_string.strip().lower()
    if a in ('true', '1'):
        return True
    elif a in ('false', '0'):
        return False
    else:
        raise Exception('un-parsable argument value %s for bool-type' %
            option_string)
