code: def _VerifyHMAC(self, comms=None):
      
      # Check the encrypted message integrity using HMAC.
      if self.hmac_type == "SIMPLE_HMAC":
        msg = comms.encrypted
        digest = comms.hmac
      elif self.hmac_type == "FULL_HMAC":
        msg = b"".join([
            comms.encrypted, comms.encrypted_cipher,
            comms.encrypted_cipher_metadata,
            comms.packet_iv.SerializeToString(),
            struct.pack("<I", comms.api_version)
        ])
        digest = comms.full_hmac
      else:
        raise DecryptionError("HMAC type no supported.")
  
      try:
        rdf_crypto.HMAC(self.cipher.hmac_key).Verify(msg, digest)
      except rdf_crypto.VerificationError as e:
        raise DecryptionError("HMAC verification failed: %s" % e)
  
      return True
docs: Verifies the HMAC.
  
      This method raises a DecryptionError if the received HMAC does not
      verify. If the HMAC verifies correctly, True is returned.
  
      Args:
        comms: The comms RdfValue to verify.
  
      Raises:
        DecryptionError: The HMAC did not verify.
  
      Returns:
        True