code: def _format_json(item):
      if isinstance(item, (date, datetime)):
          return item.isoformat()
      return encode_exception(item)
  
imports: import argparse
  import re
  from datetime import date, datetime
  from typing import TYPE_CHECKING, Dict, Iterable
  from funcy import lmap
  from dvc.cli import formatter
  from dvc.cli.command import CmdBase
  from dvc.cli.utils import append_doc_link
  from dvc.commands.metrics import DEFAULT_PRECISION
  from dvc.exceptions import DvcException
  from dvc.log import logger
  from dvc.ui import ui
  from dvc.utils.serialize import encode_exception
label_desc: Use image node_id 5 for calling a global function with example usage: _format_json(item) and returns: encode_exception, item