<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toblocks(self, chunk_size='auto', padding=None):
 """ Convert to blocks which represent subdivisions of the images data. 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'. In spark mode, 'auto' will choose a chunk size to make the resulting blocks ~100 MB in size. In local mode, 'auto' will create a single block. Tuple of ints interpreted as 'pixels per dimension'. padding : tuple or int Amount of padding along each dimensions for blocks. If an int, then the same amount of padding is used for all dimensions """

        from thunder.blocks.blocks import Blocks
        from thunder.blocks.local import LocalChunks

        if self.mode == 'spark':
            if chunk_size is 'auto':
                chunk_size = str(max([int(1e5/self.shape[0]), 1]))
            chunks = self.values.chunk(chunk_size, padding=padding).keys_to_values((0,))

        if self.mode == 'local':
            if chunk_size is 'auto':
                chunk_size = self.shape[1:]
            chunks = LocalChunks.chunk(self.values, chunk_size, padding=padding)

        return Blocks(chunks)