from to_unicode cimport _text def api_func(s): text_input = _text(s) # ...