code: def save_npz(object, handle):
      
      # there is a bug where savez doesn't actually accept a file handle.
      log.warning("Saving npz files currently only works locally. :/")
      path = handle.name
      handle.close()
      if type(object) is dict:
          np.savez(path, **object)
      elif type(object) is list:
          np.savez(path, *object)
      else:
          log.warning("Saving non dict or list as npz file, did you maybe want npy?")
          np.savez(path, object)
docs: Save dict of numpy array as npz file.