<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toarray(self):
 """ Convert blocks to local ndarray """

        if self.mode == 'spark':
            return self.values.unchunk().toarray()

        if self.mode == 'local':
            return self.values.unchunk()