def get_bulk_asn_whois(addresses=None, retry_count=3, timeout=120):
    """
    The function for retrieving ASN information for multiple IP addresses from
    Cymru via port 43/tcp (WHOIS).

    Args:
        addresses (:obj:`list` of :obj:`str`): IP addresses to lookup.
        retry_count (:obj:`int`): The number of times to retry in case socket
            errors, timeouts, connection resets, etc. are encountered.
            Defaults to 3.
        timeout (:obj:`int`): The default timeout for socket connections in
            seconds. Defaults to 120.

    Returns:
        str: The raw ASN bulk data, new line separated.

    Raises:
        ValueError: addresses argument must be a list of IPv4/v6 address
            strings.
        ASNLookupError: The ASN bulk lookup failed.
    """

    if not isinstance(addresses, list):

        raise ValueError('addresses argument must be a list of IPv4/v6 '
                         'address strings.')

    try:

        # Create the connection for the Cymru whois query.
        conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        conn.settimeout(timeout)
        log.debug('ASN bulk query initiated.')
        conn.connect((CYMRU_WHOIS, 43))

        # Query the Cymru whois server, and store the results.
        conn.sendall((
            ' -r -a -c -p -f begin\n{0}\nend'.format(
                '\n'.join(addresses))
        ).encode())

        data = ''
        while True:

            d = conn.recv(4096).decode()
            data += d

            if not d:

                break

        conn.close()

        return str(data)

    except (socket.timeout, socket.error) as e:  # pragma: no cover

        log.debug('ASN bulk query socket error: {0}'.format(e))
        if retry_count > 0:

            log.debug('ASN bulk query retrying (count: {0})'.format(
                str(retry_count)))
            return get_bulk_asn_whois(addresses, retry_count - 1, timeout)

        else:

            raise ASNLookupError('ASN bulk lookup failed.')

    except:  # pragma: no cover

        raise ASNLookupError('ASN bulk lookup failed.')