def merge(left, right):
    """Merges an integer list that has two sorted sublists."""
    result = []
    i, j = 0, 0
    while i < len(left) and j < len(right):
        # Left and right sublists are ordered, move indices for sublists depending on
        # which sublist holds next smallest element.
        if left[i] < right[j]:
            result.append(left[i])
            i += 1
        else:
            result.append(right[j])
            j += 1
    while i < len(left):
        # When right sublist is empty.
        result.append(left[i])
        i += 1
    while j < len(right):
        # When left sublist is empty.
        result.append(right[j])
        j += 1
    return result