'Iterate over the datasets of a given history, recursing into collections, and
calling fn on each dataset.
Uses the same kwargs as `contents` above.'

def map_datasets(self, history, fn, **kwargs):

    returned = []
    contents = self.contents(history, **kwargs)
    for content in contents:
        if isinstance(content, self.subcontainer_class):
            processed_list = self.subcontainer_manager.map_datasets(content, fn)
            returned.extend(processed_list)
        else:
            processed = fn(content)
            returned.append(processed)
    return returned
