def _remove_unused_security_group_info(self):
        filtered_ports = self.filtered_ports.values()

        remote_sgs_to_remove = self._determine_remote_sgs_to_remove(
            filtered_ports)

        for ip_version, remote_sg_ids in six.iteritems(remote_sgs_to_remove):
            if self.enable_ipset:
                self._remove_ipsets_for_remote_sgs(ip_version, remote_sg_ids)

        self._remove_sg_members(remote_sgs_to_remove)

        # Remove unused security group rules
        for remove_group_id in self._determine_sg_rules_to_remove(
                filtered_ports):
            self.sg_rules.pop(remove_group_id, None)
Remove any unnecessary local security group info or unused ipsets.
dataset/ETHPy150Open openstack/neutron/neutron/agent/linux/iptables_firewall.py/IptablesFirewallDriver._remove_unused_security_group_info