def _merge(left, right):
    """Merge two lists and return the merged result
    """
    result = []

    while len(left) or len(right):
        if len(left) and len(right):
            if left[0] <= right[0]:
                result.append(left.pop(0))
            else:
                result.append(right.pop(0))
        elif len(left):
            result.extend(left)
            left = []
        elif len(right):
            result.extend(right)
            right = []
    return result