docs: def open_sciobj_file_by_path_ctx(abs_path, write=False):
      """Open the file containing the Science Object bytes at the custom location
      ``abs_path`` in the local filesystem.
  
      If ``write`` is True, the file is opened for writing and any missing directores are
      created. Return the file handle and file_url with the file location in a suitable
      form for storing in the DB.
  
      If nothing was written to the file, delete it.
  
      """
      if write:
          d1_common.utils.filesystem.create_missing_directories_for_file(abs_path)
      try:
          with open(abs_path, 'wb' if write else 'rb') as sciobj_file:
              yield sciobj_file
      finally:
          if os.path.exists(abs_path) and not os.path.getsize(abs_path):
              os.unlink(abs_path)