<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def cartoon(self, cmap=None):
        '''Display a protein secondary structure as a pymol-like cartoon representation.

        :param cmap: is a dictionary that maps the secondary type
                    (H=helix, E=sheet, C=coil) to a hexadecimal color (0xffffff for white)
        '''
        # Parse secondary structure
        top = self.topology

        geom = gg.GeomProteinCartoon(gg.Aes(xyz=self.coordinates,
                                            types=top['atom_names'],
                                            secondary_type=top['secondary_structure']),
                                            cmap=cmap)

        primitives = geom.produce(gg.Aes())
        ids = [self.add_representation(r['rep_type'], r['options']) for r in primitives]

        def update(self=self, geom=geom, ids=ids):
            primitives = geom.produce(gg.Aes(xyz=self.coordinates))
            [self.update_representation(id_, rep_options)
                for id_, rep_options in zip(ids, primitives)]

        self.update_callbacks.append(update)
        self.autozoom(self.coordinates)