code: def get_multitask_egs_opts(
      egs_dir, egs_prefix="", archive_index=-1, use_multitask_egs=False
  ):
      """Generates egs option for multitask(or multilingual) training setup,
      if {egs_prefix}output.*.ark or {egs_prefix}weight.*.ark files exists in egs_dir.
      Each line in {egs_prefix}*.scp has a corresponding line containing
      name of the output-node in the network and language-dependent weight in
      {egs_prefix}output.*.ark or {egs_prefix}weight.*.ark respectively.
      e.g. Returns the empty string ('') if use_multitask_egs == False,
      otherwise something like:
      '--output=ark:foo/egs/output.3.ark --weight=ark:foo/egs/weights.3.ark'
      i.e. egs_prefix is "" for train and
      "valid_diagnostic." for validation.
  
      Caution: archive_index is usually an integer, but may be a string ("JOB")
      in some cases.
      """
      multitask_egs_opts = ""
      egs_suffix = (
          ".{0}".format(archive_index) if archive_index != -1 else ""
      )
  
      if use_multitask_egs:
          output_file_name = (
              "{egs_dir}/{egs_prefix}output{egs_suffix}.ark"
              "".format(
                  egs_dir=egs_dir,
                  egs_prefix=egs_prefix,
                  egs_suffix=egs_suffix,
              )
          )
          output_rename_opt = ""
          if os.path.isfile(output_file_name):
              output_rename_opt = (
                  "--outputs=ark:{output_file_name}".format(
                      output_file_name=output_file_name
                  )
              )
  
          weight_file_name = (
              "{egs_dir}/{egs_prefix}weight{egs_suffix}.ark"
              "".format(
                  egs_dir=egs_dir,
                  egs_prefix=egs_prefix,
                  egs_suffix=egs_suffix,
              )
          )
          weight_opt = ""
          if os.path.isfile(weight_file_name):
              weight_opt = "--weights=ark:{weight_file_name}" "".format(
                  weight_file_name=weight_file_name
              )
  
          multitask_egs_opts = (
              "{output_rename_opt} {weight_opt}".format(
                  output_rename_opt=output_rename_opt,
                  weight_opt=weight_opt,
              )
          )
  
      return multitask_egs_opts
  
imports: from __future__ import division
  import argparse
  import glob
  import logging
  import os
  import math
  import re
  import shutil
  import libs.common
  from libs.nnet3.train.dropout_schedule import *
  import unittest
label_desc: Use image node_id 2 for calling a global function with example usage: get_multitask_egs_opts(egs_dir, egs_prefix, archive_index, use_multitask_egs) and returns: multitask_egs_opts