def _order_complex_poles(poles):
 ordered_poles = np.sort(poles[np.isreal(poles)])
 im_poles = []
 for p in np.sort(poles[(np.imag(poles) < 0)]):
  if (np.conj(p) in poles):
   im_poles.extend((p, np.conj(p)))
 ordered_poles = np.hstack((ordered_poles, im_poles))
 if (poles.shape[0] != len(ordered_poles)):
  raise ValueError('Complex poles must come with their conjugates')
 return ordered_poles

def _order_complex_poles ( poles ) : ordered_poles = np . sort ( poles [ np . isreal ( poles ) ] ) im_poles = [ ] for p in np . sort ( poles [ ( np . imag ( poles ) < 0 ) ] ) : if ( np . conj ( p ) in poles ) : im_poles . extend ( ( p , np . conj ( p ) ) ) ordered_poles = np . hstack ( ( ordered_poles , im_poles ) ) if ( poles . shape [ 0 ] != len ( ordered_poles ) ) : raise ValueError ( 'Complex poles must come with their conjugates' ) return ordered_poles
check we have complex conjugates pairs and reorder p according to yt .