def is_monotonic(Z):
 Z = np.asarray(Z, order='c')
 is_valid_linkage(Z, throw=True, name='Z')
 return (Z[1:, 2] >= Z[:(-1), 2]).all()

def is_monotonic ( Z ) : Z = np . asarray ( Z , order = 'c' ) is_valid_linkage ( Z , throw = True , name = 'Z' ) return ( Z [ 1 : , 2 ] >= Z [ : ( - 1 ) , 2 ] ) . all ( )
returns if a function is monotonic or not .