def _get_vpn_status(self):
        """Returns None if no VPN active, Id if active."""
        # Sleep for a bit to let any changes in state finish
        sleep(0.3)
        # Check if any active connections are a VPN
        bus = dbus.SystemBus()
        vpns = []
        for name in self.active:
            manager = bus.get_object(
                "org.freedesktop.NetworkManager",
                name,
            )
            interface = dbus.Interface(manager, "org.freedesktop.DBus.Properties")
            try:
                properties = interface.GetAll("org.freedesktop.NetworkManager.Connection.Active")
                if properties.get("Vpn") or properties.get("Type") in ("wireguard", "tun"):
                    ipv4, ipv6 = self._get_ips(bus, properties["Connection"])
                    vpns.append({"name": properties.get("Id"), "ipv4": ipv4, "ipv6": ipv6})
            except dbus.DBusException:
                # the connection id has disappeared
                pass

        return vpns
Returns None if no VPN active, Id if active.
py3status/modules/vpn_status.py