Isn't it what django's `smart_str` does ?