<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_geoms(self, plot):
 """ Make information needed to draw a legend for each of the layers. For each layer, that information is a dictionary with the geom to draw the guide together with the data and the parameters that will be used in the call to geom. """

        def get_legend_geom(layer):
            if hasattr(layer.geom, 'draw_legend'):
                geom = layer.geom.__class__
            else:
                name = 'geom_{}'.format(layer.geom.legend_geom)
                geom = Registry[name]
            return geom

        # A layer either contributes to the guide, or it does not. The
        # guide entries may be ploted in the layers
        self.glayers = []
        for l in plot.layers:
            exclude = set()
            if isinstance(l.show_legend, dict):
                l.show_legend = rename_aesthetics(l.show_legend)
                exclude = {ae for ae, val in l.show_legend.items()
                           if not val}
            elif l.show_legend not in (None, True):
                continue

            matched = self.legend_aesthetics(l, plot)

            # This layer does not contribute to the legend
            if not set(matched) - exclude:
                continue

            data = self.key[matched].copy()
            data = l.use_defaults(data)

            # override.aes in guide_legend manually changes the geom
            for ae in set(self.override_aes) & set(data.columns):
                data[ae] = self.override_aes[ae]

            geom = get_legend_geom(l)
            data = remove_missing(
                data, l.geom.params['na_rm'],
                list(l.geom.REQUIRED_AES | l.geom.NON_MISSING_AES),
                '{} legend'.format(l.geom.__class__.__name__))
            self.glayers.append(
                types.SimpleNamespace(geom=geom, data=data, layer=l))
        if not self.glayers:
            return None
        return self