<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanup(self):
 """ Cleans up references to the plot on the attached Stream subscribers. """

        plots = self.traverse(lambda x: x, [Plot])
        for plot in plots:
            if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)):
                continue
            for stream in set(plot.streams):
                stream._subscribers = [
                    (p, subscriber) for p, subscriber in stream._subscribers
                    if util.get_method_owner(subscriber) not in plots]
        if self.comm:
            self.comm.close()