Try to find a document based on its document id. if inst=True, if it
        hasn't been instantiated yet, it will be.

def get_doc_from_docid(self, docid, doc_type_name=None, inst=True):
        """
        Try to find a document based on its document id. if inst=True, if it
        hasn't been instantiated yet, it will be.
        """
        assert(docid is not None)
        if docid in self._docs_by_id:
            return self._docs_by_id[docid]
        if not inst:
            return None
        doc = self.__inst_doc(docid, doc_type_name)
        if doc is None:
            return None
        self._docs_by_id[docid] = doc
        return doc