def add_sg_ingress_to_sg(self, incoming_sg, target_sg):
    current_sg_ids = set([pair['GroupId'] for perm in target_sg.ip_permissions for pair in perm['UserIdGroupPairs']])
    if (incoming_sg.id not in current_sg_ids):
        target_sg.authorize_ingress(IpPermissions=[{'IpProtocol': '-1', 'UserIdGroupPairs': [{'GroupId': incoming_sg.id}]}])
def add_sg_ingress_to_sg(self, incoming_sg, target_sg):
    current_sg_ids = set([pair['GroupId'] for perm in target_sg.ip_permissions for pair in perm['UserIdGroupPairs']])
    if (incoming_sg.id not in current_sg_ids):
        target_sg.authorize_ingress(IpPermissions=[{'IpProtocol': '-1', 'UserIdGroupPairs': [{'GroupId': incoming_sg.id}]}])