<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_cached_parent_for_taxon(self, child_taxon):
 """If the taxa are being cached, this call will create a the lineage "spike" for taxon child_taxon Expecting child_taxon to have a non-empty _taxonomic_lineage with response dicts that can create an ancestral TaxonWrapper. """

        if self._ott_id2taxon is None:
            resp = child_taxon._taxonomic_lineage[0]
            tl = child_taxon._taxonomic_lineage[1:]
            assert 'taxonomic_lineage' not in resp
            resp['taxonomic_lineage'] = tl
            return TaxonWrapper(taxonomy=child_taxon.taxonomy,
                                taxomachine_wrapper=self._wr,
                                prop_dict=resp)  # TODO recursive (indirectly)
        else:
            anc = []
            prev = None
            for resp in reversed(child_taxon._taxonomic_lineage):
                ott_id = resp['ot:ottId']
                curr = self._ott_id2taxon.get(ott_id)
                if curr is None:
                    assert 'taxonomic_lineage' not in resp
                    assert 'parent' not in resp
                    resp['parent'] = prev
                    resp['taxonomic_lineage'] = anc
                    curr = TaxonWrapper(taxonomy=child_taxon.taxonomy,
                                        taxomachine_wrapper=self._wr,
                                        prop_dict=resp)
                elif curr._parent is None and prev is not None:
                    curr._parent = prev
                prev = curr
                anc.insert(0, curr)
            return prev