code: def main(argv=None):
      args = parse_arguments(argv)
      logs_dedup_min_level = getattr(logging, args.logs_dedup_min_level)
      init_logging(
          level=args.verbosity,
          fatal=args.fatal,
          name=__name__,
          logs_dedup_min_level=logs_dedup_min_level,
      )
  
      logger.debug("Pelican version: %s", __version__)
      logger.debug("Python version: %s", sys.version.split()[0])
  
      try:
          pelican, settings = get_instance(args)
  
          if args.autoreload and args.listen:
              excqueue = multiprocessing.Queue()
              p1 = multiprocessing.Process(
                  target=autoreload, args=(args, excqueue)
              )
              p2 = multiprocessing.Process(
                  target=listen,
                  args=(
                      settings.get("BIND"),
                      settings.get("PORT"),
                      settings.get("OUTPUT_PATH"),
                      excqueue,
                  ),
              )
              try:
                  p1.start()
                  p2.start()
                  exc = excqueue.get()
                  if exc is not None:
                      logger.critical(exc)
              finally:
                  p1.terminate()
                  p2.terminate()
          elif args.autoreload:
              autoreload(args)
          elif args.listen:
              listen(
                  settings.get("BIND"),
                  settings.get("PORT"),
                  settings.get("OUTPUT_PATH"),
              )
          else:
              with console.status("Generating..."):
                  pelican.run()
      except KeyboardInterrupt:
          logger.warning("Keyboard interrupt received. Exiting.")
      except Exception as e:
          logger.critical("%s: %s", e.__class__.__name__, e)
  
          if args.verbosity == logging.DEBUG:
              console.print_exception()
          sys.exit(getattr(e, "exitcode", 1))
  
imports: import argparse
  import importlib.metadata
  import json
  import logging
  import multiprocessing
  import os
  import pprint
  import sys
  import time
  import traceback
  from collections.abc import Iterable
  from pkgutil import extend_path
  from pelican.log import console
  from pelican.log import init
  from pelican.generators import ArticlesGenerator, PagesGenerator, SourceFileGenerator, StaticGenerator, TemplatePagesGenerator
  from pelican.plugins import signals
  from pelican.plugins._utils import get_plugin_name, load_plugins
  from pelican.readers import Readers
  from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
  from pelican.settings import read_settings
  from pelican.utils import clean_output_dir, maybe_pluralize, wait_for_changes
  from pelican.writers import Writer
label_desc: Use image node_id 6 for calling a global function with example usage: main(argv) without return types