code: def _is_valid_index(self, index):
          
          if isinstance(index, int):
              return (index >= 0) and (index < len(self))
          if isinstance(index, list):
              valid = True
              for i in index:
                  valid = valid or self._is_valid_index(i)
              return valid
          return False
docs: Return ``True`` if and only if the given ``index``
          is valid.