code: def validate_cmd_response_str(name, got, expected, hex_encode=True):
      
      if got != expected:
          if hex_encode:
              got_s = got.encode('hex')
              exp_s = expected.encode('hex')
          else:
              got_s = got
              exp_s = expected
          raise(pyhsm.exception.YHSM_Error("Bad %s in response (got %s, expected %s)" \
                                               % (name, got_s, exp_s)))
      return got
docs: Check that some value returned in the response to a command matches what
      we put in the request (the command).