def _insert_or_merge_entity(entity, require_encryption=False, key_encryption_key=None):
_validate_entity(entity)<EOL>_validate_encryption_unsupported(require_encryption, key_encryption_key)<EOL>request = HTTPRequest()<EOL>request.method = '<STR_LIT>'<EOL>request.headers = {<EOL>_DEFAULT_CONTENT_TYPE_HEADER[<NUM_LIT:0>]: _DEFAULT_CONTENT_TYPE_HEADER[<NUM_LIT:1>],<EOL>_DEFAULT_ACCEPT_HEADER[<NUM_LIT:0>]: _DEFAULT_ACCEPT_HEADER[<NUM_LIT:1>],<EOL>}<EOL>request.body = _get_request_body(_convert_entity_to_json(entity))<EOL>return request<EOL>
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.