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

        from thunder.images.images import Images

        if self.mode == 'spark':
            values = self.values.values_to_keys((0,)).unchunk()

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

        return Images(values)