'Create a bridge unless it already exists.'

def ensure_bridge(self, bridge_name, interface=None, update_interface=True):

    if (not self._bridge_exists_and_ensure_up(bridge_name)):
        LOG.debug('Starting    bridge    %(bridge_name)s    for    subinterface    %(interface)s', {'bridge_name': bridge_name, 'interface': interface})
        bridge_device = bridge_lib.BridgeDevice.addbr(bridge_name)
        if bridge_device.setfd(0):
            return
        if bridge_device.disable_stp():
            return
        if bridge_device.link.set_up():
            return
        LOG.debug('Done    starting    bridge    %(bridge_name)s    for    subinterface    %(interface)s', {'bridge_name': bridge_name, 'interface': interface})
    else:
        bridge_device = bridge_lib.BridgeDevice(bridge_name)
    if (not interface):
        return bridge_name
    if update_interface:
        self.update_interface_ip_details(bridge_name, interface)
    if (not bridge_device.owns_interface(interface)):
        try:
            bridge = bridge_lib.BridgeDevice.get_interface_bridge(interface)
            if bridge:
                bridge.delif(interface)
            bridge_device.addif(interface)
        except Exception as e:
            LOG.error(_LE('Unable    to    add    %(interface)s    to    %(bridge_name)s!    Exception:    %(e)s'), {'interface': interface, 'bridge_name': bridge_name, 'e': e})
            return
    return bridge_name
