<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generators(self):
 """ Connected Generators within the grid Returns ------- list List of Generator Objects """

        if not self._generators:
            generators = list(self.graph.nodes_by_attribute('generator'))
            generators.extend(list(self.graph.nodes_by_attribute(
                'generator_aggr')))
            return generators
        else:
            return self._generators