code: def render_cell(value, database):
      # Render {"href": "...", "label": "..."} as link
      if not isinstance(value, str):
          return None
      stripped = value.strip()
      if not stripped.startswith("{") and stripped.endswith("}"):
          return None
      try:
          data = json.loads(value)
      except ValueError:
          return None
      if not isinstance(data, dict):
          return None
      if set(data.keys()) != {"href", "label"}:
          return None
      href = data["href"]
      if not (
          href.startswith("/")
          or href.startswith("http://")
          or href.startswith("https://")
      ):
          return None
      return markupsafe.Markup(
          '<a data-database="{database}" href="{href}">{label}</a>'.format(
              database=database,
              href=markupsafe.escape(data["href"]),
              label=markupsafe.escape(data["label"] or "") or "&nbsp;",
          )
      )
  
file_path: datasette/tests/plugins/my_plugin_2.py
imports: from datasette import hookimpl
  from datasette.utils.asgi import Response
  from functools import wraps
  import markupsafe
  import json
label_desc: Use image node_id 2 for calling a global function with example usage: render_cell(value, database) and returns: markupsafe, None, None, None, None, None, None