Validation function for parser, logging level argument.

def valid_level(value):
    """Validation function for parser, logging level argument."""
    value = value.upper()
    if getattr(logging, value, None) is None:
        raise argparse.ArgumentTypeError("%s is not a valid level" % value)
    return value