code: def _dump_json_to_file(filepath, data, allow_overwrite=False):
      if os.path.isfile(filepath) and not allow_overwrite:
          return
      try:
          with tempfile.NamedTemporaryFile(
              mode="w", dir=os.path.dirname(filepath), delete=False
          ) as f:
              json.dump(data, f)
          os.rename(f.name, filepath)
      finally:
          # clean up in case anything goes wrong
          if f and os.path.isfile(f.name):
              os.remove(f.name)
  
imports: import collections
  import glob
  import json
  import os
  import random
  import tempfile
  import time
  from collections import namedtuple
  from metaflow.exception import MetaflowInternalError, MetaflowTaggingError
  from metaflow.metadata.metadata import ObjectOrder
  from metaflow.metaflow_config import DATASTORE_LOCAL_DIR
  from metaflow.metadata import MetadataProvider
  from metaflow.tagging_util import MAX_USER_TAG_SET_SIZE, validate_tags
label_desc: Use image node_id 22 for calling the LocalMetadataProvider obj's underlying member method code with example usage: obj._dump_json_to_file(filepath, data, allow_overwrite) without return types