<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def commentmap(self, cache=True):
 """return the comments from the docx, keyed to string id."""

        if self.__commentmap is not None and cache==True:
            return self.__commentmap
        else:
            x = self.xml(src='word/comments.xml')
            d = Dict()
            if x is None: return d
            for comment in x.root.xpath("w:comment", namespaces=self.NS):
                id = comment.get("{%(w)s}id" % self.NS)
                typ = comment.get("{%(w)s}type" % self.NS)
                d[id] = Dict(id=id, type=typ, elem=comment)
            if cache==True: self.__commentmap = d
            return d