def _get_two_lowest(matching_terms, counts):
    """Gets two lowest frequency matching terms

    Assumes that len(matching_terms) >= 2

    Parameters
    ----------
    matching_terms : {str}
        The set of matching words
    counts : {str: int}
        A dictionary of word counts for the text from which the chunk
        comes

    Returns
    -------
    lowest_term : str
        lowest frequency term
    next_lowest_term : str
        second lowest frequency term

    Examples
    --------
    >>> matching_terms = {'a', 'b'}
    >>> counts = {'a': 5, 'b': 10}
    >>> _get_two_lowest(matching_terms, counts)
    'a', 'b'

    >>> matching_terms = {'a', 'b', 'c'}
    >>> counts = {'a': 5, 'b': 10, 'c': 1}
    >>> _get_two_lowest(matching_terms, counts)
    'c', 'a'
    """
    assert len(matching_terms) >= 2, 'not enough matching terms'
    match_tuple = tuple(matching_terms)
    # lowest and next_lowest are tuples of (term, count)
    lowest = (match_tuple[0], counts[match_tuple[0]])
    next_lowest = (match_tuple[1], counts[match_tuple[1]])
    if lowest[1] > next_lowest[1]:
        tmp = lowest
        lowest = next_lowest
        next_lowest = tmp
    for term in match_tuple[2:]:
        term_count = counts[term]
        if term_count < lowest[1]:
            next_lowest = lowest
            lowest = (term, term_count)
        elif term_count < next_lowest[1]:
            next_lowest = (term, term_count)
    return lowest[0], next_lowest[0]