def merge(list1, list2):
    """
    Merge two sorted lists.

    Returns a new sorted list containing those elements that are in
    either list1 or list2.

    This function can be iterative.
    """
    merged = []
    l1_copy = list(list1)
    l2_copy = list(list2)

    if len(list1) == 0 or len(list2) == 0:
        return list1 + list2

    while len(l1_copy) > 0 and len(l2_copy) > 0:
        if l1_copy[0] == l2_copy[0]:
            merged.append(l1_copy.pop(0))
            merged.append(l2_copy.pop(0))
        elif l1_copy[0] < l2_copy[0]:
            merged.append(l1_copy.pop(0))
        else:
            merged.append(l2_copy.pop(0))

    merged = merged + l1_copy + l2_copy

    return merged