class_docstr: A little helper to provide minimal interface to interact with Figshare
      
class_docstr_tok: ["A","little","helper","to","provide","minimal","interface","to","interact","with","Figshare"]
code: def upload_file(self, fname, files_url):
      # In v2 API seems no easy way to "just upload".  Need to initiate,
      # do uploads
      # and finalize
      # TODO: check if the file with the same name already available, and offer
      # to remove/prune it
      import os
      from datalad.utils import md5sum
      from datalad.ui import ui
  
      file_rec = {
          "md5": md5sum(fname),
          "name": os.path.basename(fname),
          "size": os.stat(fname).st_size,
      }
      # Initiate upload
      j = self.post(files_url, file_rec)
      file_endpoint = j["location"]
      file_info = self.get(file_endpoint)
      file_upload_info = self.get(file_info["upload_url"])
  
      pbar = ui.get_progressbar(
          label=fname, total=file_rec["size"]  # fill_text=f.name,
      )
      with open(fname, "rb") as f:
          for part in file_upload_info["parts"]:
              udata = dict(file_info, **part)
              if part["status"] == "PENDING":
                  f.seek(part["startOffset"])
                  data = f.read(
                      part["endOffset"] - part["startOffset"] + 1
                  )
                  url = "{upload_url}/{partNo}".format(**udata)
                  ok = self.put(
                      url, data=data, binary=True, return_json=False
                  )
                  assert ok == b"OK"
              pbar.update(part["endOffset"], increment=False)
          pbar.finish()
  
      # complete upload
      jcomplete = self.post(file_endpoint, return_json=False)
      return file_info
  
imports: from datalad.utils import unlink
  from datalad.interface.base import Interface
  from datalad.interface.base import build_doc
  from datalad.interface.results import get_status_dict
  import logging
label_desc: Use image node_id 7 for calling the FigshareRESTLaison obj's underlying member method code with example usage: obj.upload_file(fname, files_url) and returns: file_info