human
Complete this python program:
def _transform(providers, transform_fun, out_mapping_type=dict):
assistant
#Here is the Python code you requested.

    """Syntactic sugar for transforming a providers dict.
    transform_fun takes a (vpkg, pset) mapping and runs it on each
    pair in nested dicts.
    """
    def mapiter(mappings):
        if isinstance(mappings, dict):
            return iteritems(mappings)
        else:
            return iter(mappings)
    return dict(((name, out_mapping_type([transform_fun(vpkg, pset) for (vpkg, pset) in mapiter(mappings)])) for (name, mappings) in providers.items()))