def merge(left, right):
    """Merges two sorted lists.
    Args:
        left: A sorted list.
        right: A sorted list.

    Returns:
        The sorted list resulting from merging the two sorted sublists.

    Requires:
        left and right are sorted.
    """

    items = []

    i = 0
    j = 0
    while i < len(left) and j < len(right):
        if left[i] <= right[j]:
            items.append(left[i])
            i = i + 1
        else:
            items.append(right[j])
            j = j + 1

    if i < len(left):
        items.extend(left[i:])
    elif j < len(right):
        items.extend(right[j:])

    return items