use text_type instead of str