#NEWLINE# def _determine_remote_sgs_to_remove( self , filtered_ports ) : #NEWLINE# #INDENT# "Calculate which remote security groups we don't need anymore.\n\n        We do the calculation for each ip_version.\n        " #NEWLINE# sgs_to_remove_per_ipversion = { #NEWLINE# #INDENT# constants . IPv4 : set ( ) , #NEWLINE# constants . IPv6 : set ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# remote_group_id_sets = self . _get_remote_sg_ids_sets_by_ipversion ( filtered_ports ) #NEWLINE# for ( ip_version , remote_group_id_set ) in six . iteritems ( remote_group_id_sets ) : #NEWLINE# #INDENT# sgs_to_remove_per_ipversion [ ip_version ] . update ( ( set ( self . pre_sg_members ) - remote_group_id_set ) ) #NEWLINE# #UNINDENT# return sgs_to_remove_per_ipversion