@classmethod
def flatten(cls, apis):
    built = cls._empty()
    for api in apis.values():
        procs = api.get('processes', [])
        built.setdefault('processes', []).extend(procs)
        for command in ('neighbor-changes', 'negotiated', 'fsm', 'signal'):
            built.setdefault(command, []).extend((procs if api.get(command, False) else []))
        for direction in ('send', 'receive'):
            data = api.get(direction, {})
            for action in ('parsed', 'packets', 'consolidate', 'open', 'update', 'notification', 'keepalive', 'refresh', 'operational'):
                built.setdefault(('%s-%s' % (direction, action)), []).extend((procs if data.get(action, False) else []))
    return built
@classmethod
def flatten(cls, apis):
    built = cls._empty()
    for api in apis.values():
        procs = api.get('processes', [])
        built.setdefault('processes', []).extend(procs)
        for command in ('neighbor-changes', 'negotiated', 'fsm', 'signal'):
            built.setdefault(command, []).extend((procs if api.get(command, False) else []))
        for direction in ('send', 'receive'):
            data = api.get(direction, {})
            for action in ('parsed', 'packets', 'consolidate', 'open', 'update', 'notification', 'keepalive', 'refresh', 'operational'):
                built.setdefault(('%s-%s' % (direction, action)), []).extend((procs if data.get(action, False) else []))
    return built