code: def tospark(self, engine=None):
          
          from thunder.images.readers import fromarray
  
          if self.mode == 'spark':
              logging.getLogger('thunder').warn('images already in spark mode')
              pass
  
          if engine is None:
              raise ValueError('Must provide a SparkContext')
  
          return fromarray(self.toarray(), engine=engine)
docs: Convert to distributed spark mode.