Improve elif/else usage in iter_encoded