'Given a port, calculates the remote sg references by ip_version.'

def _get_remote_sg_ids_sets_by_ipversion(self, filtered_ports):

    remote_group_id_sets = {constants.IPv4: set(), constants.IPv6: set()}
    for port in filtered_ports:
        remote_sg_ids = self._get_remote_sg_ids(port)
        for ip_version in (constants.IPv4, constants.IPv6):
            remote_group_id_sets[ip_version] |= remote_sg_ids[ip_version]
    return remote_group_id_sets
