'Returns a list or dict which matches the type signature of dependency.
Args:
dependency: DagInput, PipelineKey, Pipeline instance, or dictionary
mapping names to those values.
outputs: A database of computed unit outputs. A dictionary mapping
Pipeline to list of objects.
Returns:
A list or dictionary of computed unit outputs which matches the type
signature of the given dependency.'

def _get_outputs_as_signature(self, dependency, outputs):

    def _get_outputs_for_key(unit_or_key, outputs):
        if isinstance(unit_or_key, pipeline.PipelineKey):
            if (not outputs[unit_or_key.unit]):
                return outputs[unit_or_key.unit]
            assert isinstance(outputs[unit_or_key.unit], dict)
            return outputs[unit_or_key.unit][unit_or_key.key]
        assert isinstance(unit_or_key, (pipeline.Pipeline, DagInput))
        return outputs[unit_or_key]
    if isinstance(dependency, dict):
        return dict([(name, _get_outputs_for_key(unit_or_key, outputs)) for (name, unit_or_key) in dependency.items()])
    return _get_outputs_for_key(dependency, outputs)
