code: def prepare_register_list(register_dict: Dict[str, Union[bool, Sequence[int]]]):
      
      if not isinstance(register_dict, dict):
          raise TypeError("register_dict must be a dict but got " + repr(register_dict))
  
      for k, v in register_dict.items():
          if isinstance(v, bool):
              assert v    # If boolean v must be True
              continue
  
          indices = [int(x) for x in v]  # support ranges, numpy, ...
  
          if not all(x >= 0 for x in indices):
              raise TypeError("Negative indices into classical arrays are not allowed.")
          register_dict[k] = indices
  
      return register_dict
docs: Canonicalize classical addresses for the payload and ready MemoryReference instances
      for serialization.
  
      This function will cast keys that are iterables of int-likes to a list of Python
      ints. This is to support specifying the register offsets as ``range()`` or numpy
      arrays. This mutates ``register_dict``.
  
      :param register_dict: The classical memory to retrieve. Specified as a dictionary:
          the keys are the names of memory regions, and the values are either (1) a list of
          integers for reading out specific entries in that memory region, or (2) True, for
          reading out the entire memory region.