code: def _replace_newline(obj):
      """Replaces '\n' with '<br>' for all strings in a collection."""
      if isinstance(obj, dict):
          d = dict()
          for key, val in list(obj.items()):
              d[key] = _replace_newline(val)
          return d
      elif isinstance(obj, list):
          l = list()
          for index, entry in enumerate(obj):
              l += [_replace_newline(entry)]
          return l
      elif isinstance(obj, str):
          s = obj.replace("\n", "<br>")
          if s != obj:
              warnings.warn(
                  "Looks like you used a newline character: '\\n'.\n\n"
                  "Plotly uses a subset of HTML escape characters\n"
                  "to do things like newline (<br>), bold (<b></b>),\n"
                  "italics (<i></i>), etc. Your newline characters \n"
                  "have been converted to '<br>' so they will show \n"
                  "up right on your Plotly figure!"
              )
          return s
      else:
          return obj
  
imports: import json
  import warnings
  import os
  from plotly import exceptions, optional_imports
  from plotly.files import PLOTLY_DIR
label_desc: Use image node_id 6 for calling a global function with example usage: _replace_newline(obj) and returns: d, l, s, obj