docs: def _insert_or_replace_entity(entity):
      '''
      Constructs an insert or replace entity request.
      '''
      _validate_entity(entity)
  
      request = HTTPRequest()
      request.method = 'PUT'
      request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
                          _DEFAULT_ACCEPT_HEADER]
      request.body = _get_request_body(_convert_entity_to_json(entity))
  
      return request