<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cli(argv=None):
 """CLI entry point for mozdownload."""

    kwargs = parse_arguments(argv or sys.argv[1:])

    log_level = kwargs.pop('log_level')
    logging.basicConfig(format='%(levelname)s | %(message)s', level=log_level)
    logger = logging.getLogger(__name__)

    # Configure logging levels for sub modules. Set to ERROR by default.
    sub_log_level = logging.ERROR
    if log_level == logging.getLevelName(logging.DEBUG):
        sub_log_level = logging.DEBUG
    logging.getLogger('redo').setLevel(sub_log_level)
    logging.getLogger('requests').setLevel(sub_log_level)
    logging.getLogger('thclient').setLevel(sub_log_level)

    try:
        scraper_type = kwargs.pop('scraper_type')

        # If a URL has been specified use the direct scraper
        if kwargs.get('url'):
            scraper_type = 'direct'

        build = factory.FactoryScraper(scraper_type, **kwargs)
        if kwargs.get('print_url'):
            logger.info(build.url)
        else:
            build.download()
    except KeyboardInterrupt:
        logger.error('Download interrupted by the user')