code: def download_mnist_retry(data_dir, max_num_retries=20):
      """Try to download mnist dataset and avoid errors"""
      for _ in range(max_num_retries):
          try:
              return input_data.read_data_sets(data_dir, one_hot=True)
          except tf.errors.AlreadyExistsError:
              time.sleep(1)
      raise Exception("Failed to download MNIST.")
  
imports: from __future__ import absolute_import, division, print_function
  import logging
  import math
  import tempfile
  import time
  import argparse
  import tensorflow
  from tensorflow.examples.tutorials.mnist import input_data
  import nni
label_desc: Use image node_id 1 for calling a global function with example usage: download_mnist_retry(data_dir, max_num_retries) and returns: input_data