def METHOD_NAME(level):
    """
    :param level: expressed in string (upper or lower case) or integer
    :return: integer representation of the log level or None
    """
    if type(level) is int:
        return level
    # This could be a string storing a number.
    try:
        return int(level)
    except ValueError:
        pass
    # Look up the name in the logging module.
    try:
        value = getattr(logging, level.upper())
        if type(value) is int:
            return value
        else:
            return None
    except AttributeError:
        return None