replace str to text_type & pep8