code: def disassociate_elastic_ips(self):
          
          log = logging.getLogger(self.cls_logger + '.disassociate_elastic_ips')
  
          try:
              address_info = self.get_elastic_ips()
          except AWSAPIError:
              _, ex, trace = sys.exc_info()
              msg = 'Unable to determine Elastic IPs on this EC2 instance'
              log.error(msg)
              raise AWSAPIError, msg, trace
  
          # Return is no elastic IPs were found
          if not address_info:
              log.info('No elastic IPs found to disassociate')
              return
  
          # Disassociate each Elastic IP
          for address in address_info['Addresses']:
              association_id = address['AssociationId']
              public_ip = address['PublicIp']
              log.info('Attempting to disassociate address {p} from Association ID: {a}'.format(
                      p=public_ip, a=association_id))
              try:
                  self.client.disassociate_address(PublicIp=public_ip, AssociationId=association_id)
              except ClientError:
                  _, ex, trace = sys.exc_info()
                  msg = 'There was a problem disassociating Public IP {p} from Association ID {a}'.format(
                          p=public_ip, a=association_id)
                  log.error(msg)
                  raise AWSAPIError, msg, trace
              else:
                  log.info('Successfully disassociated Public IP: {p}'.format(p=public_ip))
docs: For each attached Elastic IP, disassociate it
  
          :return: None
          :raises AWSAPIError