'Schedule possible deletion of the given SG.
This function must be called when the number of ports
associated to sg_id drops to zero, as it isn\'t possible
to know SG deletions from agents due to RPC API design.'

def _schedule_sg_deletion_maybe(self, sg_id):

    sec_group = self.sg_port_map.get_or_create_sg(sg_id)
    if ((not sec_group.members) or (not sec_group.ports)):
        self.sg_to_delete.add(sg_id)
