def loc_info(text, index):
        '''Location of `index` in source code `text`.'''
        if index > len(text):
            raise ValueError('Invalid index.')
        line, last_ln = text.count('\n', 0, index), text.rfind('\n', 0, index)
        col = index - (last_ln + 1)
        return (line, col)
Location of `index` in source code `text`.