def _build_map_of_offset_to_line_number(source):
    """
    For a multiline source file, return {character_pos: line}
    """
    start_index = 0
    index_to_line_number = {}
    for line_number, line in enumerate(source.splitlines(), 1):
        for index in range(start_index, start_index + len(line) + 1):
            index_to_line_number[index] = line_number
        start_index += len(line) + 1
    return index_to_line_number
