<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_loglevel(level: Union[int, str, None] = None) -> None: """Set proper log-level. :arg Optional[int, str] level: Level to be set. If None, use proper log level from command line option. Default value is ``logging.INFO``. """

    if level is not None:
        lv = level_to_int(level)
    elif config.logging:
        lv = level_to_int(config.logging)
    elif config.debug:
        lv = logging.DEBUG
    else:
        lv = logging.INFO
    root_logger.setLevel(lv)
    _log_handler.setLevel(lv)