'Process data through the flowchart, returning the output.
Keyword arguments must be the names of input terminals.
The return value is a dict with one key per output terminal.'

def process(self, **args):

    data = {}
    order = self.processOrder()
    for (n, t) in self.inputNode.outputs().items():
        if (n in args):
            data[t] = args[n]
    ret = {}
    for (c, arg) in order:
        if (c == 'p'):
            node = arg
            if (node is self.inputNode):
                continue
            outs = list(node.outputs().values())
            ins = list(node.inputs().values())
            args = {}
            for inp in ins:
                inputs = inp.inputTerminals()
                if (len(inputs) == 0):
                    continue
                if inp.isMultiValue():
                    args[inp.name()] = dict([(i, data[i]) for i in inputs if (i in data)])
                else:
                    args[inp.name()] = data[inputs[0]]
            if (node is self.outputNode):
                ret = args
            else:
                try:
                    if node.isBypassed():
                        result = node.processBypassed(args)
                    else:
                        result = node.process(display=False, **args)
                except:
                    print ('Error    processing    node    %s.    Args    are:    %s' % (str(node), str(args)))
                    raise
                for out in outs:
                    try:
                        data[out] = result[out.name()]
                    except KeyError:
                        pass
        elif (c == 'd'):
            if (arg in data):
                del data[arg]
    return ret
