def first_arg_to_level_name(arg):
try:<EOL><INDENT>return int(arg)<EOL><DEDENT>except ValueError:<EOL><INDENT>arg = arg.upper()<EOL>for level in LEVELS:<EOL><INDENT>if level in arg:<EOL><INDENT>return level<EOL><DEDENT><DEDENT>return None<EOL><DEDENT>
Decide what level the argument specifies and return it.  The argument
    must contain (case-insensitive) one of the values in LEVELS or be an integer
    constant.  Otherwise None will be returned.