'Delete a dynamic segment.'

def release_dynamic_segment(self, context, segment_id):

    segment = segments_db.get_segment_by_id(context, segment_id)
    if segment:
        driver = self.drivers.get(segment.get(ml2_api.NETWORK_TYPE))
        if driver:
            if isinstance(driver.obj, api.TypeDriver):
                driver.obj.release_segment(context.session, segment)
            else:
                driver.obj.release_segment(context, segment)
            segments_db.delete_network_segment(context, segment_id)
        else:
            LOG.error(_LE("Failed    to    release    segment    '%s'    because    network    type    is    not    supported."), segment)
    else:
        LOG.debug('No    segment    found    with    id    %(segment_id)s', segment_id)
