Don't really think this needs to be a multiline if statement, especially given that you made it shorter by extracting logic into the `encode_string` method.