'Delete an existing segment.'

@log_helpers.log_method_call
def delete_segment(self, context, uuid, for_net_delete=False):

    segment_dict = self.get_segment(context, uuid)
    registry.notify(resources.SEGMENT, events.BEFORE_DELETE, self.delete_segment, context=context, segment=segment_dict, for_net_delete=for_net_delete)
    with db_api.context_manager.writer.using(context):
        if (not network.NetworkSegment.delete_objects(context, id=uuid)):
            raise exceptions.SegmentNotFound(segment_id=uuid)
        registry.notify(resources.SEGMENT, events.PRECOMMIT_DELETE, self.delete_segment, context=context, segment=segment_dict)
    registry.notify(resources.SEGMENT, events.AFTER_DELETE, self.delete_segment, context=context, segment=segment_dict)
