<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def sanitize_config_loglevel(level):
    '''
    Kinda sorta backport of loglevel sanitization for Python 2.6.
    '''
    if sys.version_info[:2] != (2, 6) or isinstance(level, (int, long)):
        return level
    lvl = None
    if isinstance(level, basestring):
        lvl = logging._levelNames.get(level)
    if not lvl:
        raise ValueError('Invalid log level, %s' % level)
    return lvl