<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _update_subplot(self, subplot, spec):
 """ Updates existing subplots when the subplot has been assigned to plot an element that is not an exact match to the object it was initially assigned. """


        # See if the precise spec has already been assigned a cyclic
        # index otherwise generate a new one
        if spec in self.cyclic_index_lookup:
            cyclic_index = self.cyclic_index_lookup[spec]
        else:
            group_key = spec[:self.style_grouping]
            self.group_counter[group_key] += 1
            cyclic_index = self.group_counter[group_key]
            self.cyclic_index_lookup[spec] = cyclic_index

        subplot.cyclic_index = cyclic_index
        if subplot.overlay_dims:
            odim_key = util.wrap_tuple(spec[-1])
            new_dims = zip(subplot.overlay_dims, odim_key)
            subplot.overlay_dims = util.OrderedDict(new_dims)