code: def validate_args(opt):
      """
      Validate the cmdline args passed into the script.
  
      :param opt: The arguments of te parser
  
      :return: Returns extension of output file. None if no output file
      """
      if not PathManager.exists(opt["input"]):
          raise IOError("Input File does not exist")
      if opt["output"] is None:
          return None
      extension = opt["output"].split(".")[-1]
      if extension not in ["html", "pdf", "png"]:
          raise Exception(
              "Extension not specified/supported. Specify one of '.html', '.pdf' or '.png' output files"
          )
      opt["user_icon"] = check_icon_arg(
          opt["user_icon"], HUMAN_EMOJI_IMG
      )
      opt["alt_icon"] = check_icon_arg(opt["alt_icon"], ALT_EMOJI_IMG)
      return extension
  
imports: import os
  import json
  import random
  import tempfile
  import subprocess
  from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript, register_script
  from parlai.utils.io import PathManager
label_desc: Use image node_id 8 for calling a global function with example usage: validate_args(opt) and returns: extension, None