code: def main():
      args = get_args()
  
      if args.reco2file_and_channel is not None:
          reco2file_and_channel = {}
          with common_lib.smart_open(args.reco2file_and_channel) as fh:
              for line in fh:
                  parts = line.strip().split()
                  reco2file_and_channel[parts[0]] = (parts[1], parts[2])
  
      utt2spk = {}
      with common_lib.smart_open(args.utt2spk) as fh:
          for line in fh:
              parts = line.strip().split()
              utt2spk[parts[0]] = parts[1]
  
      with common_lib.smart_open(
          args.segments
      ) as segments_reader, common_lib.smart_open(
          args.rttm_file, "w"
      ) as rttm_writer:
          for line in segments_reader:
              parts = line.strip().split()
  
              utt = parts[0]
              spkr = utt2spk[utt]
  
              reco = parts[1]
              file_id = reco
              channel = 1
  
              if args.reco2file_and_channel is not None:
                  try:
                      file_id, channel = reco2file_and_channel[reco]
                  except KeyError:
                      raise RuntimeError(
                          "Could not find recording {0} in {1}".format(
                              reco, args.reco2file_and_channel
                          )
                      )
  
              start_time = float(parts[2])
              duration = float(parts[3]) - start_time
  
              print(
                  "SPEAKER {0} {1} {2:7.2f} {3:7.2f} "
                  "<NA> <NA> {4} <NA>".format(
                      file_id, channel, start_time, duration, spkr
                  ),
                  file=rttm_writer,
              )
  
imports: from __future__ import print_function
  import argparse
  import sys
  import libs.common
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types