'Fetch filtered list of contents of history.'

def contents_iter(self, **kwds):

    default_contents_types = ['dataset']
    types = kwds.get('types', default_contents_types)
    iters = []
    if ('dataset' in types):
        iters.append(self.__dataset_contents_iter(**kwds))
    if ('dataset_collection' in types):
        iters.append(self.__collection_contents_iter(**kwds))
    return galaxy.util.merge_sorted_iterables(operator.attrgetter('hid'), *iters)
