def line_range(lines, ind1, comment_flag='#'):
    """
    Find a range of data lines within a line list.

    Given an input line list and a starting index, subsequent lines are
    examined to see where the next comment line is.  Comment lines are
    assumed to start with the # character by default, or one can set this
    with the comment_flag variable in the call.  Lines that are not comments
    are assumed to be data lines.  The index of the next comment line is
    returned, or the index that gives a range to the end of the line list
    where there is no such comment line after the index specified.

    Parameters
    ----------
        lines :  A list of input lines (assumed to be from the readlines()
                 function)

        ind1 :   A starting index in the list of lines

        comment_flag:   An optional string variable that marks comment lines

    Returns
    -------
        n1 : an integer value for the next comment line (assumed to
             start with '#') in the list of input lines, or the index
             for the length of the line list if no other comment line is
             found
    """
    ncomment = len(comment_flag)
    for n1 in range(ind1+1, len(lines)):
        if comment_flag in lines[n1][0:ncomment]:
            return n1
    return len(lines)