code: def upload(
      self, token, filename, name, finishCallback=None, endpoint=None
  ):
      _, ext = os.path.splitext(filename)
      if ext == ".csv":
          tmpdir = tempfile.mkdtemp()
          self._log("Temporary dir {} created".format(tmpdir))
  
          try:
              self._log("Prepare csv data")
              csv_data, data_files = self.createCsvData(filename)
              self._log("Prepare tar file")
              tarfile = self.createTemporaryTar(
                  name, csv_data, data_files, tmpdir
              )
              self._log("Upload")
              res = self.uploadFile(endpoint, token, tarfile, name)
          finally:
              shutil.rmtree(tmpdir, ignore_errors=True)
              self._log("Temporary dir removed")
  
          if res:
              self._log("Finished")
  
      elif ext == ".tar":
          if self.uploadFile(endpoint, token, filename, name):
              self._log("Finished")
      else:
          self._log(
              "filename with extension {} is not supported.".format(ext)
          )
          if finishCallback is not None:
              finishCallback(False)
          return
  
      if finishCallback is not None:
          finishCallback(True)
  
imports: import boto3
  import csv
  import json
  import os
  import urllib.parse
  import urllib.request
  import shutil
  import tarfile
  import tempfile
  import threading
  import tqdm
label_desc: Use image node_id 6 for calling the Uploader obj's underlying member method code with example usage: obj.upload(token, filename, name, finishCallback, endpoint) without return types