def sliceAnnotation(self, k, sliceInfo, limitCache=True):
        'create annotation and cache it'
        a = self.get_annot_obj(k, sliceInfo)
        try: # APPLY CACHE SIZE LIMIT IF ANY
            if limitCache and self.maxCache < len(self._weakValueDict):
                self._weakValueDict.clear()
        except AttributeError:
            pass
        self._weakValueDict[k] = a # CACHE THIS IN OUR DICT
        return a
dataset/ETHPy150Open cjlee112/pygr/pygr/annotation.py/AnnotationDB.sliceAnnotation/original