docs: def _insert_or_merge_entity(entity, require_encryption=False, key_encryption_key=None):
      '''
      Constructs an insert or merge entity request.
      :param entity:
          The entity to insert. Could be a dict or an entity object.
      :param object key_encryption_key:
          The user-provided key-encryption-key. Must implement the following methods:
          wrap_key(key)--wraps the specified key using an algorithm of the user's choice.
          get_key_wrap_algorithm()--returns the algorithm used to wrap the specified symmetric key.
          get_kid()--returns a string key id for this key-encryption-key.
      '''
      _validate_entity(entity)
      _validate_encryption_unsupported(require_encryption, key_encryption_key)
  
      request = HTTPRequest()
      request.method = 'MERGE'
      request.headers = {
          _DEFAULT_CONTENT_TYPE_HEADER[0]: _DEFAULT_CONTENT_TYPE_HEADER[1],
          _DEFAULT_ACCEPT_HEADER[0]: _DEFAULT_ACCEPT_HEADER[1],
      }
      request.body = _get_request_body(_convert_entity_to_json(entity))
  
      return request