code: def compare_dict(dict1, dict2, equivalent=True, msg="", tol=10e-8):
      for key in dict1:
          if key not in dict2:
              return (
                  False,
                  "{0} should be {1}".format(
                      list(dict1.keys()), list(dict2.keys())
                  ),
              )
      for key in dict1:
          if isinstance(dict1[key], dict):
              equivalent, msg = compare_dict(
                  dict1[key], dict2[key], tol=tol
              )
          elif isinstance(dict1[key], Num) and isinstance(
              dict2[key], Num
          ):
              if not comp_nums(dict1[key], dict2[key], tol):
                  return (
                      False,
                      "['{0}'] = {1} should be {2}".format(
                          key, dict1[key], dict2[key]
                      ),
                  )
          elif is_num_list(dict1[key]) and is_num_list(dict2[key]):
              if not comp_num_list(dict1[key], dict2[key], tol):
                  return (
                      False,
                      "['{0}'] = {1} should be {2}".format(
                          key, dict1[key], dict2[key]
                      ),
                  )
          elif not (dict1[key] == dict2[key]):
              return (
                  False,
                  "['{0}'] = {1} should be {2}".format(
                      key, dict1[key], dict2[key]
                  ),
              )
          if not equivalent:
              return False, "['{0}']".format(key) + msg
      return equivalent, msg
  
file_path: plotly.py/packages/python/plotly/plotly/tests/utils.py
imports: import copy
  from numbers import Number
  from unittest import TestCase
  import plotly.io
label_desc: Use image node_id 1 for calling a global function with example usage: compare_dict(dict1, dict2, equivalent, msg, tol) and returns: equivalent,  msg, False,  str, False,  unknown, False,  str, False,  str, False,  str