def __get_rev(self, key, version, **kwa):
if '<STR_LIT>' in kwa:<EOL><INDENT>doc = kwa['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>if type(version) is int:<EOL><INDENT>if version == <NUM_LIT:0>:<EOL><INDENT>order = pymongo.ASCENDING<EOL><DEDENT>elif version == -<NUM_LIT:1>:<EOL><INDENT>order = pymongo.DESCENDING<EOL><DEDENT>doc = self._collection.find_one({'<STR_LIT:k>': key}, sort=[['<STR_LIT:d>', order]])<EOL><DEDENT>elif type(version) is datetime:<EOL><INDENT>ver = self.__round_time(version)<EOL>doc = self._collection.find_one({'<STR_LIT:k>': key, '<STR_LIT:d>': ver})<EOL><DEDENT><DEDENT>if doc is None:<EOL><INDENT>raise KeyError('<STR_LIT>'<EOL>.format(key, str(version)))<EOL><DEDENT>coded_val = doc['<STR_LIT:v>']<EOL>return pickle.loads(coded_val)<EOL>
Obtain particular version of the doc at key.