def get_split_indices(word, curr_tokens, include_joiner_token, joiner):
    """Gets indices for valid substrings of word, for iterations > 0.
    For iterations > 0, rather than considering every possible substring, we only
    want to consider starting points corresponding to the start of wordpieces in
    the current vocabulary.
    Args:
      word: string we want to split into substrings
      curr_tokens: string to int dict of tokens in vocab (from previous iteration)
      include_joiner_token: bool whether to include joiner token
      joiner: string used to indicate suffixes
    Returns:
      list of ints containing valid starting indices for word
    """

    indices = []
    start = 0
    while start < len(word):
        end = len(word)
        while end > start:
            subtoken = word[start:end]
            # Subtoken includes the joiner token.
            if include_joiner_token and start > 0:
                subtoken = joiner + subtoken
            # If subtoken is part of vocab, "end" is a valid start index.
            if subtoken in curr_tokens:
                indices.append(end)
                break
            end -= 1

        if end == start:
            return None
        start = end

    return indices