<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toseries(self, chunk_size='auto'):
 """ Converts to series data. This method is equivalent to images.toblocks(size).toSeries(). Parameters chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interpreted as memory size (in kilobytes, e.g. '64'). The exception is the string 'auto', which will choose a chunk size to make the resulting blocks ~100 MB in size. Tuple of ints interpreted as 'pixels per dimension'. Only valid in spark mode. """

        from thunder.series.series import Series

        if chunk_size is 'auto':
            chunk_size = str(max([int(1e5/self.shape[0]), 1]))

        n = len(self.shape) - 1
        index = arange(self.shape[0])

        if self.mode == 'spark':
            return Series(self.values.swap((0,), tuple(range(n)), size=chunk_size), index=index)

        if self.mode == 'local':
            return Series(self.values.transpose(tuple(range(1, n+1)) + (0,)), index=index)