code: def val_index(
      self, val_index: _typing.Optional[_typing.Iterable[int]]
  ):
      if not (
          val_index is None or isinstance(val_index, _typing.Iterable)
      ):
          raise TypeError
      elif val_index is None:
          self.__val_index: _typing.Optional[
              _typing.Iterable[int]
          ] = None
      elif isinstance(val_index, _typing.Iterable):
          if len(list(val_index)) == 0:
              self.__val_index: _typing.Optional[
                  _typing.Iterable[int]
              ] = None
              return
          if not all([isinstance(i, int) for i in val_index]):
              raise TypeError
          if not (0 <= min(val_index) <= max(val_index) < len(self)):
              raise ValueError
          self.__val_index: _typing.Optional[
              _typing.Iterable[int]
          ] = val_index
  
imports: import typing
label_desc: Use image node_id 16 for calling the InMemoryDataset obj's underlying member method code with example usage: obj.val_index(val_index) without return types