code: def job_record_to_dict(
      record: Dict[str, Any], name: Optional[str]
  ) -> JobListEntryV1Alpha:
      format_version = BatchFormatVersion(record["format_version"])
  
      db_status = record["status"]
      if db_status:
          db_status = json.loads(db_status)
          (
              exit_code,
              duration,
          ) = format_version.get_status_exit_code_duration(db_status)
      else:
          exit_code = None
          duration = None
  
      if record["cost_breakdown"] is not None:
          record["cost_breakdown"] = cost_breakdown_to_dict(
              json.loads(record["cost_breakdown"])
          )
  
      return {
          "batch_id": record["batch_id"],
          "job_id": record["job_id"],
          "name": name,
          "user": record["user"],
          "billing_project": record["billing_project"],
          "state": record["state"],
          "exit_code": exit_code,
          "duration": duration,
          "cost": coalesce(record["cost"], 0),
          "msec_mcpu": record["msec_mcpu"],
          "cost_breakdown": record["cost_breakdown"],
      }
  
file_path: hail/batch/batch/batch.py
imports: import json
  import logging
  from typing import Any, Dict, List, Optional
  from gear import transaction
  from hailtop.batch_client.types import CostBreakdownEntry, JobListEntryV1Alpha
  from hailtop.utils import humanize_timedelta_msecs, time_msecs_str
  from .batch_format_version import BatchFormatVersion
  from .exceptions import NonExistentBatchError, OpenBatchError
  from .utils import coalesce
label_desc: Use image node_id 3 for calling a global function with example usage: job_record_to_dict(record, name) and returns: dict