code: def read_msg() -> Optional[Dict]:
      """Read Line delimited JSON from stdin."""
      msg = json.loads(sys.stdin.readline().strip())
  
      if "terminate" in (msg.get("type"), msg.get("event")):
          # terminate message received
          return None
  
      if msg.get("event") not in ("download", "upload"):
          logger.critical("Received unexpected message")
          sys.exit(1)
  
      return msg
  
file_path: huggingface_hub/src/huggingface_hub/commands/lfs.py
imports: import json
  import os
  import subprocess
  import sys
  from argparse import _SubParsersAction
  from typing import Dict, List, Optional
  from huggingface_hub.commands import BaseHuggingfaceCLICommand
  from huggingface_hub.lfs import LFS_MULTIPART_UPLOAD_COMMAND, SliceFileObj
  from ..utils import get_session, hf_raise_for_status, logging
label_desc: Use image node_id 2 for calling a global function with example usage: read_msg() and returns: msg, None