def get_engine_by_slug(slug=None):
 if ((not slug) or (type(slug) is not str)):
  raise TypeError("Invalid slug '%s'", slug)
 selected_engines = filter((lambda engine: (hasattr(engine, 'SLUG') and (engine.SLUG == slug))), get_engines())
 if (len(selected_engines) == 0):
  raise ValueError(("No TTS engine found for slug '%s'" % slug))
 else:
  if (len(selected_engines) > 1):
   print ("WARNING: Multiple TTS engines found for slug '%s'. " + ('This is most certainly a bug.' % slug))
  engine = selected_engines[0]
  if (not engine.is_available()):
   raise ValueError((("TTS engine '%s' is not available (due to " + 'missing dependencies, etc.)') % slug))
  return engine

def get_engine_by_slug ( slug = None ) : if ( ( not slug ) or ( type ( slug ) is not str ) ) : raise TypeError ( "Invalid slug '%s'" , slug ) selected_engines = filter ( ( lambda engine : ( hasattr ( engine , 'SLUG' ) and ( engine . SLUG == slug ) ) ) , get_engines ( ) ) if ( len ( selected_engines ) == 0 ) : raise ValueError ( ( "No TTS engine found for slug '%s'" % slug ) ) else : if ( len ( selected_engines ) > 1 ) : print ( "WARNING: Multiple TTS engines found for slug '%s'. " + ( 'This is most certainly a bug.' % slug ) ) engine = selected_engines [ 0 ] if ( not engine . is_available ( ) ) : raise ValueError ( ( ( "TTS engine '%s' is not available (due to " + 'missing dependencies, etc.)' ) % slug ) ) return engine
returns: an stt engine implementation available on the current platform raises: valueerror if no speaker implementation is supported on this platform .