
The python example is (also) used to test the feature. That is because currently nmcli does not yet have support for ovs.external-ids and this API is only accessible via D-Bus (or a tool like this example).
These examples show how to call libnm from Python using GObject introspection.