def match_nested_lists(l1, l2):
    """ Match nested lists term for term

    :param l1: first list
    :param l2: second list
    :return: True or False

    This differs from "match_lists_as_sets" in the sense that order is important. The
    lists in question can only contain other lists or objects for which == is a valid
    comparison.
    """
    if not isinstance(l1, list): return False
    if not isinstance(l2, list): return False
    if len(l1) != len(l2): return False
    for i in range(len(l1)):
        if isinstance(l1[i], list) and isinstance(l2[i], list):
            if not match_nested_lists(l1[i], l2[i]): return False
        elif not isinstance(l1[i], list) and not isinstance(l2[i], list):
            if l1[i] != l2[i]: return False
        else: return False
    return True