def encode_request(name, new_value):
client_message = ClientMessage(payload_size=calculate_size(name, new_value))<EOL>client_message.set_message_type(REQUEST_TYPE)<EOL>client_message.set_retryable(RETRYABLE)<EOL>client_message.append_str(name)<EOL>client_message.append_bool(new_value is None)<EOL>if new_value is not None:<EOL><INDENT>client_message.append_data(new_value)<EOL><DEDENT>client_message.update_frame_length()<EOL>return client_message<EOL>
Encode request into client_message