code: def write_provenance(results, filename="provenance", format="all"):
      prov = None
      try:
          ps = ProvStore()
          ps.add_results(results)
          prov = ps.write_provenance(filename=filename, format=format)
      except Exception as e:
          import traceback
  
          err_msg = traceback.format_exc()
          if getattr(e, "args"):
              err_msg += "\n\nException arguments:\n" + ", ".join(
                  ['"%s"' % arg for arg in e.args]
              )
          logger.warning(
              "Writing provenance failed - Exception details:\n%s",
              err_msg,
          )
  
      return prov
  
imports: from collections import OrderedDict
  from copy import deepcopy
  from pickle import dumps
  import os
  import getpass
  import platform
  from uuid import uuid1
  import simplejson
  import numpy
  import prov.model
  from ..None import get_info, logging, __version__
  from .filemanip import md5, hashlib, hash_infile
label_desc: Use image node_id 6 for calling a global function with example usage: write_provenance(results, filename, format) and returns: prov