'Remove any unnecessary local security group info or unused ipsets.
This function has to be called after applying the last iptables
rules, so we\'re in a point where no iptable rule depends
on an ipset we\'re going to delete.'

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 remote_sgs_to_remove.items():
        if self.enable_ipset:
            self._remove_ipsets_for_remote_sgs(ip_version, remote_sg_ids)
    self._remove_sg_members(remote_sgs_to_remove)
    for remove_group_id in self._determine_sg_rules_to_remove(filtered_ports):
        self.sg_rules.pop(remove_group_id, None)
