def get_line_column(data, line, column, position):
    """Returns the line and column of the given position in the string.

    Column is 1-based, that means, that the first character in a line has column
    equal to 1. A line with n character also has a n+1 column, which sits just
    before the newline.

    Args:
      data: the original string.
      line: the line at which the string starts.
      column: the column at which the string starts.
      position: the position within the string. It is 0-based.

    Returns:
      A tuple (line, column) with the offset of the position.
    """
    data = data[:position]
    toks = data.splitlines()
    if not toks or data[-1] in '\n\r':
        toks.append('')
    if len(toks) > 1:
        return line + len(toks) - 1, 1 + len(toks[-1])
    else:
        return line, column + position