code: def getLogLevelNo(level):
      
      if isinstance(level,(int,long)):
          return level
      try:
          return(int(logging.getLevelName(level.upper())))
      except:
          raise ValueError('illegal loglevel %s' % level)
docs: Return numerical log level or raise ValueError.
  
      A valid level is either an integer or a string such as WARNING etc.