'Filter out all objects whose dataset_id is in use.
:param objects: Objects to filter.
:param get_dataset_id: Callable to extract a unicode dataset ID
from an object. By default looks up ``dataset_id`` attribute.
:return list: Filtered objects.'

def __call__(self, objects, get_dataset_id=(lambda d: unicode(d.dataset_id))):

    result = []
    for obj in objects:
        u_dataset_id = get_dataset_id(obj)
        dataset_id = UUID(u_dataset_id)
        if (u_dataset_id in self._in_use_datasets):
            continue
        if (dataset_id in self._leases):
            if (self._leases[dataset_id].node_id == self._node_id):
                continue
        result.append(obj)
    return result
