def find_interface(device, name): for i in xmlutils.iterDescendantsWithAttribute(device, 'interface', 'name', name): return i return None
def find_device(scenario, name): tagName = ('device', 'host', 'router') for d in xmlutils.iterDescendantsWithAttribute(scenario, tagName, 'name', name): return d return None