<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_last_doc(self):
 """Returns the last document stored in Mongo. """


        def docs_by_ts():
            for meta_collection_name in self._meta_collections():
                meta_coll = self.meta_database[meta_collection_name]
                for ts_ns_doc in meta_coll.find(limit=-1).sort("_ts", -1):
                    yield ts_ns_doc

        return max(docs_by_ts(), key=lambda x: x["_ts"])