code: 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