docs: def insert_or_replace_entity(self, table_name, entity, timeout=None):
          '''
          Replaces an existing entity or inserts a new entity if it does not
          exist in the table. Because this operation can insert or update an
          entity, it is also known as an "upsert" operation.
  
          If insert_or_replace_entity is used to replace an entity, any properties 
          from the previous entity will be removed if the new entity does not define 
          them.
  
          :param str table_name:
              The name of the table in which to insert or replace the entity.
          :param entity:
              The entity to insert or replace. Could be a dict or an entity object. 
              Must contain a PartitionKey and a RowKey.
          :type entity: dict or :class:`~azure.storage.table.models.Entity`
          :param int timeout:
              The server timeout, expressed in seconds.
          :return: The etag of the entity.
          :rtype: str
          '''
          _validate_not_none('table_name', table_name)
          request = _insert_or_replace_entity(entity, self.require_encryption, self.key_encryption_key,
                                              self.encryption_resolver_function)
          request.host_locations = self._get_host_locations()
          request.query['timeout'] = _int_to_str(timeout)
          request.path = _get_entity_path(table_name, entity['PartitionKey'], entity['RowKey'])
  
          return self._perform_request(request, _extract_etag)