code: def main(args):
      # setup some basic things
      utils.import_user_module(args)
  
      os.makedirs(args.destdir, exist_ok=True)
  
      logger.addHandler(
          logging.FileHandler(
              filename=os.path.join(args.destdir, "preprocess.log"),
          )
      )
      logger.info(args)
  
      assert (
          args.dataset_impl != "huffman"
      ), "preprocessing.py doesn't support Huffman yet, use HuffmanCodeBuilder directly."
  
      # build dictionaries
  
      target = not args.only_source
  
      if not args.srcdict and os.path.exists(
          _dict_path(args.source_lang, args.destdir)
      ):
          raise FileExistsError(
              _dict_path(args.source_lang, args.destdir)
          )
  
      if (
          target
          and not args.tgtdict
          and os.path.exists(_dict_path(args.target_lang, args.destdir))
      ):
          raise FileExistsError(
              _dict_path(args.target_lang, args.destdir)
          )
  
      task = tasks.get_task(args.task)
  
      if args.joined_dictionary:
          assert (
              not args.srcdict or not args.tgtdict
          ), "cannot use both --srcdict and --tgtdict with --joined-dictionary"
  
          if args.srcdict:
              src_dict = task.load_dictionary(args.srcdict)
          elif args.tgtdict:
              src_dict = task.load_dictionary(args.tgtdict)
          else:
              assert (
                  args.trainpref
              ), "--trainpref must be set if --srcdict is not specified"
              src_dict = _build_dictionary(
                  {
                      _train_path(lang, args.trainpref)
                      for lang in [args.source_lang, args.target_lang]
                  },
                  task=task,
                  args=args,
                  src=True,
              )
          tgt_dict = src_dict
      else:
          if args.srcdict:
              src_dict = task.load_dictionary(args.srcdict)
          else:
              assert (
                  args.trainpref
              ), "--trainpref must be set if --srcdict is not specified"
              src_dict = _build_dictionary(
                  [_train_path(args.source_lang, args.trainpref)],
                  task=task,
                  args=args,
                  src=True,
              )
  
          if target:
              if args.tgtdict:
                  tgt_dict = task.load_dictionary(args.tgtdict)
              else:
                  assert (
                      args.trainpref
                  ), "--trainpref must be set if --tgtdict is not specified"
                  tgt_dict = _build_dictionary(
                      [_train_path(args.target_lang, args.trainpref)],
                      task=task,
                      args=args,
                      tgt=True,
                  )
          else:
              tgt_dict = None
  
      # save dictionaries
  
      src_dict.save(_dict_path(args.source_lang, args.destdir))
      if target and tgt_dict is not None:
          tgt_dict.save(_dict_path(args.target_lang, args.destdir))
  
      if args.dict_only:
          return
  
      _make_all(args.source_lang, src_dict, args)
      if target:
          _make_all(args.target_lang, tgt_dict, args)
  
      # align the datasets if needed
      if args.align_suffix:
          _make_all_alignments(args)
  
      logger.info("Wrote preprocessed data to {}".format(args.destdir))
  
      if args.alignfile:
          _align_files(args, src_dict=src_dict, tgt_dict=tgt_dict)
  
imports: import logging
  import os
  import shutil
  import sys
  import typing
  from argparse import Namespace
  from itertools import zip_longest
  from fairseq import options, tasks, utils
  from fairseq.binarizer import AlignmentDatasetBinarizer, FileBinarizer, VocabularyDatasetBinarizer
  from fairseq.data import Dictionary
label_desc: Use image node_id 14 for calling a global function with example usage: main(args) without return types