code: def _safe(json_str, _swap):
      out = json_str
      for unsafe_char, safe_char in _swap:
          if unsafe_char in out:
              out = out.replace(unsafe_char, safe_char)
      return out
  
imports: import json
  import decimal
  import datetime
  import warnings
  from pathlib import Path
  from plotly.io._utils import validate_coerce_fig_to_dict, validate_coerce_output_type
  from _plotly_utils.optional_imports import get_module
  from _plotly_utils.basevalidators import ImageUriValidator
label_desc: Use image node_id 2 for calling a global function with example usage: _safe(json_str, _swap) and returns: out