code: def _process_reservations(self, reservations):
          
  
          reservations = reservations['Reservations']
  
          private_ip_addresses = []
          private_hostnames = []
          public_ips = []
          public_hostnames = []
          for reservation in reservations:
              for instance in reservation['Instances']:
                  private_ip_addresses.append(instance['PrivateIpAddress'])
                  private_hostnames.append(instance['PrivateDnsName'])
  
                  if 'PublicIpAddress' in instance:
                      public_ips.append(instance['PublicIpAddress'])
                  elif not self.remove_nones:
                      public_ips.append(None)
  
                  if ('PublicDnsName' in instance) & (not self.remove_nones):
                      public_hostnames.append(instance['PublicDnsName'])
                  elif not self.remove_nones:
                      public_hostnames.append(None)
  
          return {
              'private': {
                  'ips': private_ip_addresses,
                  'hostnames': private_hostnames
              },
              'public': {
                  'ips': public_ips,
                  'hostnames': public_hostnames
              },
              'reservations': reservations
          }
docs: Given a dict with the structure of a response from boto3.ec2.describe_instances(...),
          find the public/private ips.
          :param reservations:
          :return: