code: def get_checkpoint_path(model_path):
      
      if os.path.basename(model_path) == model_path:
          model_path = os.path.join('.', model_path)  # avoid #4921 and #6142
      if os.path.basename(model_path) == 'checkpoint':
          assert tfv1.gfile.Exists(model_path), model_path
          model_path = tf.train.latest_checkpoint(os.path.dirname(model_path))
          # to be consistent with either v1 or v2
  
      # fix paths if provided a wrong one
      new_path = model_path
      if '00000-of-00001' in model_path:
          new_path = model_path.split('.data')[0]
      elif model_path.endswith('.index'):
          new_path = model_path.split('.index')[0]
      if new_path != model_path:
          logger.info(
              "Checkpoint path {} is auto-corrected to {}.".format(model_path, new_path))
          model_path = new_path
      assert tfv1.gfile.Exists(model_path) or tfv1.gfile.Exists(model_path + '.index'), model_path
      return model_path
docs: Work around TF problems in checkpoint path handling.
  
      Args:
          model_path: a user-input path
      Returns:
          str: the argument that can be passed to NewCheckpointReader