for key, attr in [
        ('USER_AGENT', 'user_agent'),
        ('LOG_LEVEL', 'scrapy_log_level')
    ]:
        if getattr(args, attr, None) is not None: