'ids in id_dict are "marked". They can be searched for by
using the search term ``marked:true``. Pass in an empty dictionary or
set to clear marked ids.
:param id_dict: Either a dictionary mapping ids to values or a set
of ids. In the latter case, the value is set to \'true\' for all ids. If
a mapping is provided, then the search can be used to search for
particular values: ``marked:value``'

def set_marked_ids(self, id_dict):

    old_marked_ids = set(self.marked_ids)
    if (not hasattr(id_dict, u'items')):
        self.marked_ids = dict.fromkeys(id_dict, u'true')
    else:
        self.marked_ids = dict(izip(id_dict.iterkeys(), imap(unicode, id_dict.itervalues())))
    cmids = set(self.marked_ids)
    self.cache.clear_search_caches((old_marked_ids | cmids))
    if (old_marked_ids != cmids):
        for funcref in self.marked_listeners.itervalues():
            func = funcref()
            if (func is not None):
                func(old_marked_ids, cmids)
