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