'The function for retrieving and parsing whois information for an IP
address via port 43 (WHOIS).
Args:
inc_raw: Boolean for whether to include the raw whois results in
the returned dictionary.
retry_count: The number of times to retry in case socket errors,
timeouts, connection resets, etc. are encountered.
get_referral: Boolean for whether to retrieve referral whois
information, if available.
extra_blacklist: A list of blacklisted whois servers in addition to
the global BLACKLIST.
ignore_referral_errors: Boolean for whether to ignore and continue
when an exception is encountered on referral whois lookups.
field_list: If provided, a list of fields to parse:
[\'name\', \'handle\', \'description\', \'country\', \'state\', \'city\',
\'address\', \'postal_code\', \'emails\', \'created\', \'updated\']
asn_alts: Array of additional lookup types to attempt if the
ASN dns lookup fails. Allow permutations must be enabled.
Defaults to all [\'whois\', \'http\'].
extra_org_map: Dictionary mapping org handles to RIRs. This is for
limited cases where ARIN REST (ASN fallback HTTP lookup) does
not show an RIR as the org handle e.g., DNIC (which is now the
built in ORG_MAP) e.g., {\'DNIC\': \'arin\'}. Valid RIR values are
(note the case-sensitive - this is meant to match the REST
result): \'ARIN\', \'RIPE\', \'apnic\', \'lacnic\', \'afrinic\'
Returns:
Dictionary:
:query: The IP address (String)
:asn: The Autonomous System Number (String)
:asn_date: The ASN Allocation date (String)
:asn_registry: The assigned ASN registry (String)
:asn_cidr: The assigned ASN CIDR (String)
:asn_country_code: The assigned ASN country code (String)
:nets: Dictionaries containing network information which consists
of the fields listed in the ipwhois.whois.RIR_WHOIS dictionary.
(List)
:raw: Raw whois results if the inc_raw parameter is True. (String)
:referral: Dictionary of referral whois information if get_referral
is True and the server isn\'t blacklisted. Consists of fields
listed in the ipwhois.whois.RWHOIS dictionary.
:raw_referral: Raw referral whois results if the inc_raw parameter
is True. (String)'

def lookup_whois(self, inc_raw=False, retry_count=3, get_referral=False, extra_blacklist=None, ignore_referral_errors=False, field_list=None, asn_alts=None, extra_org_map=None):

    from .whois import Whois
    results = {}
    log.debug('ASN    lookup    for    {0}'.format(self.address_str))
    (asn_data, response) = self.net.lookup_asn(retry_count=retry_count, asn_alts=asn_alts, extra_org_map=extra_org_map)
    results.update(asn_data)
    whois = Whois(self.net)
    log.debug('WHOIS    lookup    for    {0}'.format(self.address_str))
    whois_data = whois.lookup(inc_raw=inc_raw, retry_count=retry_count, response=response, get_referral=get_referral, extra_blacklist=extra_blacklist, ignore_referral_errors=ignore_referral_errors, asn_data=asn_data, field_list=field_list)
    results.update(whois_data)
    return results
