human
Complete the below
def _check_loglevel(level='info', quiet=False):

    ''''Retrieve the level code for use in logging.Logger.log().'
    '''
 What is a the Python code you requested?
assistant
#Here is the Python code you requested.
    def _bad_level(level):
        log.error("Invalid    output_loglevel    '{0}'.    Valid    levels    are:    {1}.    Falling    back    to    'info'.".format(level, ',    '.join(sorted(LOG_LEVELS, reverse=True))))
        return LOG_LEVELS['info']
    if (salt.utils.is_true(quiet) or (str(level).lower() == 'quiet')):
        return None
    try:
        level = level.lower()
        if (level not in LOG_LEVELS):
            return _bad_level(level)
    except AttributeError:
        return _bad_level(level)
    return LOG_LEVELS[level]