<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cmd_karma_bulk(infile, jsonout, badonly, verbose):
 """Show which IP addresses are inside blacklists using the Karma online service. Example: \b $ cat /var/log/auth.log | habu.extract.ipv4 | habu.karma.bulk 172.217.162.4 spamhaus_drop,alienvault_spamming 23.52.213.96 CLEAN 190.210.43.70 alienvault_malicious """


    if verbose:
        logging.basicConfig(level=logging.INFO, format='%(message)s')

    data = infile.read()

    result = {}

    for ip in data.split('\n'):
        if ip:
            logging.info('Checking ' + ip)
            response = karma(ip)
            if response:
                result[ip] = response
            elif not badonly:
                result[ip] = ['CLEAN']

    if jsonout:
        print(json.dumps(result, indent=4))
    else:
        for k,v in result.items():
            print(k, '\t', ','.join(v))