nodes: 0, module; 1, function_definition; 2, function_name:sanitize_config_loglevel; 3, parameters; 4, block; 5, identifier:level; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, string; 13, boolean_operator; 14, block; 15, assignment; 16, call; 17, block; 18, not_operator; 19, block; 20, identifier:lvl; 21, string_content:Kinda sorta backport of loglevel sanitization for Python 2.6.; 22, comparison_operator:sys.version_info[:2] != (2, 6); 23, call; 24, return_statement; 25, identifier:lvl; 26, None; 27, identifier:isinstance; 28, argument_list; 29, expression_statement; 30, identifier:lvl; 31, raise_statement; 32, subscript; 33, tuple; 34, identifier:isinstance; 35, argument_list; 36, identifier:level; 37, identifier:level; 38, identifier:basestring; 39, assignment; 40, call; 41, attribute; 42, slice; 43, integer:2; 44, integer:6; 45, identifier:level; 46, tuple; 47, identifier:lvl; 48, call; 49, identifier:ValueError; 50, argument_list; 51, identifier:sys; 52, identifier:version_info; 53, integer:2; 54, identifier:int; 55, identifier:long; 56, attribute; 57, argument_list; 58, binary_operator:'Invalid log level, %s' % level; 59, attribute; 60, identifier:get; 61, identifier:level; 62, string; 63, identifier:level; 64, identifier:logging; 65, identifier:_levelNames; 66, string_content:Invalid log level, %s
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