def _merge(left, right):
    """
    Function merges left and right parts
    Args:
        left: left part of array
        right: right part of array

    Returns:
        Sorted and merged left + right parts
    """

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

    return merge_result