docs: def lookup(self, inc_raw=False, retry_count=3, response=None,
                 get_referral=False, extra_blacklist=None,
                 ignore_referral_errors=False, asn_data=None,
                 field_list=None, is_offline=False):
          """
          The function for retrieving and parsing whois information for an IP
          address via port 43/tcp (WHOIS).
  
          Args:
              inc_raw (:obj:`bool`, optional): Whether to include the raw
                  results in the returned dictionary. Defaults to False.
              retry_count (:obj:`int`): The number of times to retry in case
                  socket errors, timeouts, connection resets, etc. are
                  encountered. Defaults to 3.
              response (:obj:`str`): Optional response object, this bypasses the
                  NIR lookup. Required when is_offline=True.
              get_referral (:obj:`bool`): Whether to retrieve referral whois
                  information, if available. Defaults to False.
              extra_blacklist (:obj:`list`): Blacklisted whois servers in
                  addition to the global BLACKLIST. Defaults to None.
              ignore_referral_errors (:obj:`bool`): Whether to ignore and
                  continue when an exception is encountered on referral whois
                  lookups. Defaults to False.
              asn_data (:obj:`dict`): Result from
                  :obj:`ipwhois.asn.IPASN.lookup` (required).
              field_list (:obj:`list` of :obj:`str`): If provided, fields to
                  parse. Defaults to:
  
                  ::
  
                      ['name', 'handle', 'description', 'country', 'state',
                      'city', 'address', 'postal_code', 'emails', 'created',
                      'updated']
  
              is_offline (:obj:`bool`): Whether to perform lookups offline. If
                  True, response and asn_data must be provided. Primarily used
                  for testing. Defaults to False.
  
          Returns:
              dict: The IP whois lookup results
  
              ::
  
                  {
                      'query' (str) - The IP address
                      'asn' (str) - The Autonomous System Number
                      'asn_date' (str) - The ASN Allocation date
                      'asn_registry' (str) - The assigned ASN registry
                      'asn_cidr' (str) - The assigned ASN CIDR
                      'asn_country_code' (str) - The assigned ASN country code
                      'asn_description' (str) - The ASN description
                      'nets' (list) - Dictionaries containing network
                          information which consists of the fields listed in the
                          ipwhois.whois.RIR_WHOIS dictionary.
                      'raw' (str) - Raw whois results if the inc_raw parameter
                          is True.
                      'referral' (dict) - Referral whois information if
                          get_referral is True and the server is not blacklisted.
                          Consists of fields listed in the ipwhois.whois.RWHOIS
                          dictionary.
                      'raw_referral' (str) - Raw referral whois results if the
                          inc_raw parameter is True.
                  }
          """
  
          # Create the return dictionary.
          results = {
              'query': self._net.address_str,
              'nets': [],
              'raw': None,
              'referral': None,
              'raw_referral': None
          }
  
          # The referral server and port. Only used if get_referral is True.
          referral_server = None
          referral_port = 0
  
          # Only fetch the response if we haven't already.
          if response is None or (not is_offline and
                                  asn_data['asn_registry'] is not 'arin'):
  
              log.debug('Response not given, perform WHOIS lookup for {0}'
                        .format(self._net.address_str))
  
              # Retrieve the whois data.
              response = self._net.get_whois(
                  asn_registry=asn_data['asn_registry'], retry_count=retry_count,
                  extra_blacklist=extra_blacklist
              )
  
              if get_referral:
  
                  # Search for a referral server.
                  for match in re.finditer(
                      r'^ReferralServer:[^\S\n]+(.+:[0-9]+)$',
                      response,
                      re.MULTILINE
                  ):
  
                      try:
  
                          temp = match.group(1)
                          if 'rwhois://' not in temp:  # pragma: no cover
                              raise ValueError
  
                          temp = temp.replace('rwhois://', '').split(':')
  
                          if int(temp[1]) > 65535:  # pragma: no cover
                              raise ValueError
  
                          referral_server = temp[0]
                          referral_port = int(temp[1])
  
                      except (ValueError, KeyError):  # pragma: no cover
  
                          continue
  
                      break
  
          # Retrieve the referral whois data.
          if get_referral and referral_server:
  
              log.debug('Perform referral WHOIS lookup')
  
              response_ref = None
  
              try:
  
                  response_ref = self._net.get_whois(
                      asn_registry='', retry_count=retry_count,
                      server=referral_server, port=referral_port,
                      extra_blacklist=extra_blacklist
                  )
  
              except (BlacklistError, WhoisLookupError):
  
                  if ignore_referral_errors:
  
                      pass
  
                  else:
  
                      raise
  
              if response_ref:
  
                  log.debug('Parsing referral WHOIS data')
  
                  if inc_raw:
  
                      results['raw_referral'] = response_ref
  
                  temp_rnet = self.parse_fields(
                      response_ref,
                      RWHOIS['fields'],
                      field_list=field_list
                  )
  
                  # Add the networks to the return dictionary.
                  results['referral'] = temp_rnet
  
          # If inc_raw parameter is True, add the response to return dictionary.
          if inc_raw:
  
              results['raw'] = response
  
          nets = []
  
          if asn_data['asn_registry'] == 'arin':
  
              nets_response = self.get_nets_arin(response)
  
          elif asn_data['asn_registry'] == 'lacnic':
  
              nets_response = self.get_nets_lacnic(response)
  
          else:
  
              nets_response = self.get_nets_other(response)
  
          nets.extend(nets_response)
  
          # Iterate through all of the network sections and parse out the
          # appropriate fields for each.
          log.debug('Parsing WHOIS data')
          for index, net in enumerate(nets):
  
              section_end = None
              if index + 1 < len(nets):
  
                  section_end = nets[index + 1]['start']
  
              try:
  
                  dt_format = RIR_WHOIS[results['asn_registry']]['dt_format']
  
              except KeyError:
  
                  dt_format = None
  
              temp_net = self.parse_fields(
                  response,
                  RIR_WHOIS[asn_data['asn_registry']]['fields'],
                  section_end,
                  net['end'],
                  dt_format,
                  field_list
              )
  
              # Merge the net dictionaries.
              net.update(temp_net)
  
              # The start and end values are no longer needed.
              del net['start'], net['end']
  
          # Add the networks to the return dictionary.
          results['nets'] = nets
  
          return results