def GetDeviceGroupHandleNgpfPy( deviceGroupNumber='1' ): for topologyHandle in ixNet.getList(ixNet.getRoot(), 'topology'): for deviceGroupHandle in ixNet.getList(topologyHandle, 'deviceGroup'): match = re.match(r'::ixNet::OBJ-/topology:[0-9]+/deviceGroup:%s' % deviceGroupNumber, deviceGroupHandle) if match: return deviceGroupHandle return 0