def location(text, index):
    """
    Location of `index` in the `text`. Report row and column numbers when
    appropriate.

    """
    if isinstance(text, str):
        line, start = text.count('\n', 0, index), text.rfind('\n', 0, index)
        column = index - (start + 1)
        return "{}:{}".format(line + 1, column + 1)
    else:
        return str(index + 1)