code: def _download_and_clean(dataset, data_dir):
      """Download MovieLens dataset in a standard format.
  
      This function downloads the specified MovieLens format and coerces it into a
      standard format. The only difference between the ml-1m and ml-20m datasets
      after this point (other than size, of course) is that the 1m dataset uses
      whole number ratings while the 20m dataset allows half integer ratings.
      """
      if dataset not in DATASETS:
          raise ValueError(
              "dataset {} is not in {{{}}}".format(
                  dataset, ",".join(DATASETS)
              )
          )
  
      data_subdir = os.path.join(data_dir, dataset)
  
      expected_files = [
          "{}.zip".format(dataset),
          RATINGS_FILE,
          MOVIES_FILE,
      ]
  
      tf.io.gfile.makedirs(data_subdir)
      if set(expected_files).intersection(
          tf.io.gfile.listdir(data_subdir)
      ) == set(expected_files):
          logging.info(
              "Dataset {} has already been downloaded".format(dataset)
          )
          return
  
      url = "{}{}.zip".format(_DATA_URL, dataset)
  
      temp_dir = tempfile.mkdtemp()
      try:
          zip_path = os.path.join(temp_dir, "{}.zip".format(dataset))
          zip_path, _ = urllib.request.urlretrieve(url, zip_path)
          statinfo = os.stat(zip_path)
          # A new line to clear the carriage return from download progress
          # logging.info is not applicable here
          print()
          logging.info(
              "Successfully downloaded {} {} bytes".format(
                  zip_path, statinfo.st_size
              )
          )
  
          zipfile.ZipFile(zip_path, "r").extractall(temp_dir)
  
          if dataset == ML_1M:
              _regularize_1m_dataset(temp_dir)
          else:
              _regularize_20m_dataset(temp_dir)
  
          for fname in tf.io.gfile.listdir(temp_dir):
              if not tf.io.gfile.exists(
                  os.path.join(data_subdir, fname)
              ):
                  tf.io.gfile.copy(
                      os.path.join(temp_dir, fname),
                      os.path.join(data_subdir, fname),
                  )
              else:
                  logging.info(
                      "Skipping copy of {}, as it already exists in the "
                      "destination folder.".format(fname)
                  )
  
      finally:
          tf.io.gfile.rmtree(temp_dir)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  import tempfile
  import zipfile
  import numpy
  import pandas
  import six
  from six.moves import urllib
  from absl import app
  from absl import flags
  from absl import logging
  import tensorflow
  from utils.flags import core
label_desc: Use image node_id 1 for calling a global function with example usage: _download_and_clean(dataset, data_dir) without return types