def dump_tap(plugins):
    tap = Tap()

    for name in sorted(plugins):
        host = plugins[name]
        if host['status'] in ['OK', 'WARN']:
            host_ok = True
        else:
            host_ok = False

        tap_host = TapTest(name, host_ok)
        tap.add_test(tap_host)

        # For each host's plugin
        for key in sorted(host['plugins']):
            plugin = host['plugins'][key]
            if not plugin['lastResult']:
                plugin_ok = False
            else:
                if plugin['lastResult']['status'] in ['OK', 'WARN']:
                    plugin_ok = True
                else:
                    plugin_ok = False

            # Add messages to test result
            messages = []
            if plugin['lastResult']:
                if plugin['lastResult']['messages']:
                    messages = plugin['lastResult']['messages']

            tap_plugin = TapTest(plugin['name'], plugin_ok, messages)
            tap_host.add_subtest(tap_plugin)

            if (plugin['lastResult'] and
                    plugin['lastResult']['componentResults']):
                # For each component result
                for component in plugin['lastResult']['componentResults']:
                    component = component['componentResult']
                    if component['status'] in ['OK', 'WARN']:
                        component_ok = True
                    else:
                        component_ok = False

                    # Add messages to test result
                    messages = []
                    if component['messages']:
                        if component['messages']:
                            messages = component['messages']

                    tap_component = TapTest(component['name'], component_ok,
                                            messages)
                    tap_plugin.add_subtest(tap_component)

    return tap.dump()
Dump plugins result to TAP
dataset/ETHPy150Open gooddata/smoker/smoker/client/cli.py/dump_tap