docs: def preprocess(train_dataset, output_dir, eval_dataset, checkpoint, pipeline_option):
      """Preprocess data in Cloud with DataFlow."""
  
      import apache_beam as beam
      import google.datalab.utils
      from . import _preprocess
  
      if checkpoint is None:
        checkpoint = _util._DEFAULT_CHECKPOINT_GSURL
  
      job_name = ('preprocess-image-classification-' +
                  datetime.datetime.now().strftime('%y%m%d-%H%M%S'))
  
      staging_package_url = _util.repackage_to_staging(output_dir)
      tmpdir = tempfile.mkdtemp()
      # suppress DataFlow warnings about wheel package as extra package.
      original_level = logging.getLogger().getEffectiveLevel()
      logging.getLogger().setLevel(logging.ERROR)
      try:
        # Workaround for DataFlow 2.0, which doesn't work well with extra packages in GCS.
        # Remove when the issue is fixed and new version of DataFlow is included in Datalab.
        extra_packages = [staging_package_url, _TF_GS_URL, _PROTOBUF_GS_URL]
        local_packages = [os.path.join(tmpdir, os.path.basename(p))
                          for p in extra_packages]
        for source, dest in zip(extra_packages, local_packages):
          file_io.copy(source, dest, overwrite=True)
  
        options = {
            'staging_location': os.path.join(output_dir, 'tmp', 'staging'),
            'temp_location': os.path.join(output_dir, 'tmp'),
            'job_name': job_name,
            'project': _util.default_project(),
            'extra_packages': local_packages,
            'teardown_policy': 'TEARDOWN_ALWAYS',
            'no_save_main_session': True
        }
        if pipeline_option is not None:
          options.update(pipeline_option)
  
        opts = beam.pipeline.PipelineOptions(flags=[], **options)
        p = beam.Pipeline('DataflowRunner', options=opts)
        _preprocess.configure_pipeline(p, train_dataset, eval_dataset,
                                       checkpoint, output_dir, job_name)
        job_results = p.run()
      finally:
        shutil.rmtree(tmpdir)
        logging.getLogger().setLevel(original_level)
  
      if (_util.is_in_IPython()):
        import IPython
        dataflow_url = 'https://console.developers.google.com/dataflow?project=%s' % \
                       _util.default_project()
        html = 'Job "%s" submitted.' % job_name
        html += '<p>Click <a href="%s" target="_blank">here</a> to track preprocessing job. <br/>' \
            % dataflow_url
        IPython.display.display_html(html, raw=True)
      return google.datalab.utils.DataflowJob(job_results)