def validate_cmd_response_str(name, got, expected, hex_encode=True):
if got != expected:<EOL><INDENT>if hex_encode:<EOL><INDENT>got_s = got.encode('<STR_LIT>')<EOL>exp_s = expected.encode('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>got_s = got<EOL>exp_s = expected<EOL><DEDENT>raise(pyhsm.exception.YHSM_Error("<STR_LIT>"% (name, got_s, exp_s)))<EOL><DEDENT>return got<EOL>
Check that some value returned in the response to a command matches what
we put in the request (the command).