@staticmethod
def _index_to_doctag(i_index, offset2doctag, max_rawint):
    """Get string key for given `i_index`, if available. Otherwise return raw int doctag (same int)."""
    candidate_offset = i_index - max_rawint - 1
    if 0 <= candidate_offset < len(offset2doctag):
        return offset2doctag[candidate_offset]
    else:
        return i_index
