def get_terms(raw_lines, term_type):
    """
    Takes a list of strings and returns a new list containing only
    lines starting with `term_type` and strips line endings.

    Term can be either of the "main" (or `!T`) type or additional (or
    `!G`) type

    Parameters
    ----------
    raw_lines : list of str
        List of lines from a '.reqn' file.
    term_type : str
        This string specifies the type of term.

    Returns
    -------
    list of str
    """
    assert term_type == '!T' or term_type == '!G', 'Invalid term type specified'
    valid_prefix_lines = [line for line in raw_lines if line.startswith(term_type)]
    no_line_endings = []
    for line in valid_prefix_lines:
        if line[-1] == '\n':
            no_line_endings.append(line[:-1])
        else:
            no_line_endings.append(line)
    return no_line_endings