def METHOD_NAME(a_num, kth, axis):
    # compute volume
    shape = a_num.shape
    volume = np.prod(shape)
    # move axis to end and flatten other
    sort_dim = shape[axis]
    flattened = (int)(volume / sort_dim)
    a_mod = a_num.swapaxes(axis, a_num.ndim - 1)
    a_mod = a_mod.reshape((flattened, sort_dim))
    for segment in range(flattened):
        if kth > 0:
            left_part = a_mod[segment, 0:kth]
            # numpy supports lexicografic complex comparrison
            max_left = left_part.__array__().max()
            if max_left > a_mod[segment, kth]:
                print(a_num)
                assert False
        if kth < sort_dim:
            right_part = a_mod[segment, kth:sort_dim]
            # numpy supports lexicografic complex comparrison
            min_right = right_part.__array__().min()
            if min_right < a_mod[segment, kth]:
                print(a_num)
                assert False