def and_combination(disjunction, term):
    """
    Join a disjunction and another term together with an AND operator. If term is a lexeme,
    then we append it to the last conjunction in the disjunction.

    If `term` is itself a disjunction, then we do a pair-wise combination of every
    conjunction in both disjunctions.

    example: "(a or b) and (c or d)"
    with disjunction as [[a], [b]] and term as [[c], [d]]
    the result is [[a, c], [a, d], [b, c], [b, d]]
    """
    if isinstance(term, list):
        # Combine two sub-expressions with AND
        return [conj1 + conj2 for conj1 in disjunction for conj2 in term]
    else:
        # Append an atom to the last expression (AND case)
        disjunction[-1].append(term)
        return disjunction