<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def workspaces(self, index=None):

 """return generator for all all workspace instances"""

        c = self.centralWidget()
        if index is None:
            return (c.widget(n) for n in range(c.count()))
        else:
            return c.widget(index)