code: def _check_loglevel(level='info'):
      '''
      Retrieve the level code for use in logging.Logger.log().
      '''
      try:
          level = level.lower()
          if level == 'quiet':
              return None
          else:
              return LOG_LEVELS[level]
      except (AttributeError, KeyError):
          log.error(
              'Invalid output_loglevel \'%s\'. Valid levels are: %s. Falling '
              'back to \'info\'.',
              level, ', '.join(sorted(LOG_LEVELS, reverse=True))
          )
          return LOG_LEVELS['info'f _check_loglevel(level='info'):
      '''
      Retrieve the level code for use in logging.Logger.log().
      '''
      try:
          level = level.lower()
          if level == 'quiet':
              return None
          else:
              return LOG_LEVELS[level]
      except (AttributeError, KeyError):
          log.error(
              'Invalid output_loglevel \'%s\'. Valid levels are: %s. Falling '
              'back to \'info\'.',
              level, ', '.join(sorted(LOG_LEVELS, reverse=True))
          )
          return LOG_LEVELS['info']
docs: Retrieve the level code for use in logging.Logger.log().