code: def main(route_files, vtypes, _random=False):
      """
      Main method to automatically modify vtypes to carla type ids in sumo route files.
      """
      for filename in route_files:
          tree = ET.parse(filename)
          root = tree.getroot()
  
          if not _random:
              index = 0
  
          counter = 0
          for vtype in root.iter("vehicle"):
              if _random:
                  new_type = random.choice(vtypes)
              else:
                  new_type = vtypes[index]
                  index = (
                      (index + 1) if index < (len(vtypes) - 1) else 0
                  )
  
              vtype.set("type", new_type)
              counter += 1
  
          tree = ET.ElementTree(root)
          tree.write(
              filename,
              pretty_print=True,
              encoding="UTF-8",
              xml_declaration=True,
          )
  
          logging.info("modified %d vtype(s) in %s", counter, filename)
  
imports: import argparse
  import fnmatch
  import json
  import logging
  import random
  import lxml.etree
label_desc: Use image node_id 1 for calling a global function with example usage: main(route_files, vtypes, _random) without return types