I don't think you need this check, you can always just call `.decode('utf-8')` on `encoded` variable.