calc_fn.tr(...) yields a copy of calc_fn in which the afferent and efferent values of the
        function have been translated. The translation is found from merging the list of 0 or more
        dictionary arguments given left-to-right followed by the keyword arguments.

def tr(self, *args, **kwargs):
        '''
        calc_fn.tr(...) yields a copy of calc_fn in which the afferent and efferent values of the
        function have been translated. The translation is found from merging the list of 0 or more
        dictionary arguments given left-to-right followed by the keyword arguments. 
        '''
        d = merge(args, kwargs)
        # make a copy
        translation = copy.copy(self)
        object.__setattr__(translation, 'afferents',
                           tuple(d[af] if af in d else af for af in self.afferents))
        object.__setattr__(translation, 'efferents',
                           tuple(d[ef] if ef in d else ef for ef in self.efferents))
        object.__setattr__(translation, 'afferent_docs',
                           ps.pmap({kk:ps.pmap({(d[k] if k in d else k):v
                                                for (k,v) in six.iteritems(vv)})
                                    for (kk,vv) in six.iteritems(self.afferent_docs)}))
        object.__setattr__(translation, 'efferent_docs',
                           ps.pmap({kk:ps.pmap({(d[k] if k in d else k):v
                                                for (k,v) in six.iteritems(vv)})
                                    for (kk,vv) in six.iteritems(self.efferent_docs)}))
        fn = self.function
        def _tr_fn_wrapper(*args, **kwargs):
            res = fn(*args, **kwargs)
            if isinstance(res, colls.Mapping):
                return {(d[k] if k in d else k):v for (k,v) in six.iteritems(res)}
            else:
                return res
        object.__setattr__(translation, 'function', _tr_fn_wrapper)
        return translation