code: def safe_json(obj):
      """Encode `obj` to JSON so that it can be embedded safely inside HTML.
  
      Parameters
      ----------
      obj : object
          object to serialize
      """
      return json.dumps(obj).replace("<", "\\u003c")
  
file_path: Theano/theano/d3viz/d3viz.py
imports: from __future__ import absolute_import, print_function, division
  import os
  import json
  import shutil
  import six
  from six import iteritems
  from theano.d3viz.formatting import PyDotFormatter
label_desc: Use image node_id 2 for calling a global function with example usage: safe_json(obj) and returns: json