'Calculate which remote security groups we don\'t need anymore.
We do the calculation for each ip_version.'

def _determine_remote_sgs_to_remove(self, filtered_ports):

    sgs_to_remove_per_ipversion = {constants.IPv4: set(), constants.IPv6: set()}
    remote_group_id_sets = self._get_remote_sg_ids_sets_by_ipversion(filtered_ports)
    for (ip_version, remote_group_id_set) in remote_group_id_sets.items():
        sgs_to_remove_per_ipversion[ip_version].update((set(self.pre_sg_members) - remote_group_id_set))
    return sgs_to_remove_per_ipversion
