<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tospark(self, engine=None):
 """ Convert to spark mode. """

        from thunder.series.readers import fromarray

        if self.mode == 'spark':
            logging.getLogger('thunder').warn('images already in local mode')
            pass

        if engine is None:
            raise ValueError('Must provide SparkContext')

        return fromarray(self.toarray(), index=self.index, labels=self.labels, engine=engine)