def find_line_starting_with_seq(the_list, seq, from_index=0, to_index=-1):
    """
    Returns index of line in the document that starts with specified char sequence. Or -1 if sequence not found.
    :param the_list: list of strings
    :param seq: char sequence to find;
    :param from_index: index in the list;
    :param to_index: index in the list, open range; if is negative, the list will be searched till the end;
    :return: index of the first occurrence of 'seq' in the list or -1 if not found
    """
    if to_index < 0:
        to_index = len(the_list)
    if from_index > to_index:
        from_index = to_index
    for i in range(from_index, to_index):
        if the_list[i].startswith(seq):
            return i
    return -1