code: def __init__(
      self,
      db: Database,  # BORROWED
      machine_name_prefix: str,
      location_monitor: CloudLocationMonitor,
      default_region: str,
      regions: List[str],
  ):
      self.db: Database = db
      self.machine_name_prefix = machine_name_prefix
      self.location_monitor = location_monitor
  
      assert default_region in regions, (default_region, regions)
      self._default_region = default_region
      self.regions = regions
  
      self.inst_coll_regex = re.compile(
          f"{self.machine_name_prefix}(?P<inst_coll>.*)-.*"
      )
      self.name_inst_coll: Dict[str, InstanceCollection] = {}
      self.name_token_cache: TimeLimitedMaxSizeCache[
          str, str
      ] = TimeLimitedMaxSizeCache(
          self.get_token_from_instance_name,
          SIXTY_SECONDS_NS,
          CACHE_CAPACITY,
          "batch-driver instance name-token cache",
      )
  
imports: import asyncio
  import collections
  import logging
  import re
  import secrets
  from typing import Any, Counter, Dict, List, Optional, Tuple
  import sortedcontainers
  from gear import Database
  from gear.time_limited_max_size_cache import TimeLimitedMaxSizeCache
  from hailtop import aiotools
  from hailtop.utils import periodically_call, secret_alnum_string, time_msecs
  from ...globals import INSTANCE_VERSION, live_instance_states
  from ...instance_config import QuantifiedResource
  from ..instance import Instance
  from ..location import CloudLocationMonitor
  from ..resource_manager import CloudResourceManager, UnknownVMState, VMDoesNotExist, VMStateCreating, VMStateRunning, VMStateTerminated
label_desc: Use image node_id 1 to create a new InstanceCollectionManager object  with example: obj = InstanceCollectionManager(db, machine_name_prefix, location_monitor, default_region, regions)