def have_pyrex():
 pyrex_impls = ('Cython.Distutils.build_ext', 'Pyrex.Distutils.build_ext')
 for pyrex_impl in pyrex_impls:
  try:
   __import__(pyrex_impl, fromlist=['build_ext']).build_ext
   return True
  except Exception:
   pass
 return False

def have_pyrex ( ) : pyrex_impls = ( 'Cython.Distutils.build_ext' , 'Pyrex.Distutils.build_ext' ) for pyrex_impl in pyrex_impls : try : __import__ ( pyrex_impl , fromlist = [ 'build_ext' ] ) . build_ext return True except Exception : pass return False
return true if cython or pyrex can be imported .