'Read certain parts of a given subject.'

def _RandomlyReadSubject(self, subject, predicates):

    for (j, timestamps) in predicates.items():
        which = self.rand.randint(0, 2)
        if (which == 0):
            data_store.DB.ResolveMulti(subject, [(self.predicate_template % j)], timestamp=data_store.DB.ALL_TIMESTAMPS, token=self.token)
        elif (which == 1):
            if timestamps:
                ts = self.rand.choice(timestamps)
                data_store.DB.ResolveMulti(subject, [(self.predicate_template % j)], timestamp=(ts, ts), token=self.token)
        elif (which == 2):
            data_store.DB.Resolve(subject, (self.predicate_template % j), token=self.token)
        self.Register()
    which = self.rand.randint(0, 1)
    if (which == 0):
        data_store.DB.ResolvePrefix(subject, 'task:flow', timestamp=data_store.DB.NEWEST_TIMESTAMP, token=self.token)
    elif (which == 1):
        data_store.DB.ResolvePrefix(subject, 'task:', timestamp=data_store.DB.NEWEST_TIMESTAMP, token=self.token)
    self.Register()
