def check_existing_floatingip(self, floating_ip=None, delete=False):
        count = 0
        found_ips = []
        for ip in self.list_floating_ips():
            if floating_ip == 'all' or floating_ip.match(
                    ip['floating_ip_address']):
                if delete:
                    # asynchronous call, we do not check that it worked
                    self.nova_client.delete_floatingip(ip['id'])
                found_ips.append(ip['floating_ip_address'])
                count += 1
        if count > 0:
            if delete:
                self.notifications.append("Found %d ip(s): %s"
                                          % (count, '{' + ', '.join(
                                             found_ips) + '}'))
            else:
                self.msgs.append("Found %d ip(s): %s. "
                                 % (count,  ', '.join(found_ips))
                                 + "Won't create test floating ip. "
                                 + "Please check and delete.")
dataset/ETHPy150Open openstack/monitoring-for-openstack/oschecks/neutron.py/Novautils.check_existing_floatingip/original