code: def commit(self, if_match=None, wait=True, timeout=None):
          if not self._changes:
              LOG.debug("No changes available for %s: %s",
                        self.__class__.__name__, self.resource_id)
              return
          LOG.debug("Apply all the changes on the current %s: %s",
                    self.__class__.__name__, self.resource_id)
          client = self._get_client()
          endpoint = self._endpoint.format(
              resource_id=self.resource_id or "",
              parent_id=self.parent_id or "",
              grandparent_id=self.grandparent_id or "")
          request_body = self.dump(include_read_only=False)
          response = client.update_resource(endpoint, data=request_body,
                                            if_match=if_match)
          elapsed_time = 0
          while wait:
              self.refresh()
              if self.is_ready():
                  break
              elapsed_time += CONFIG.HNV.retry_interval
              if timeout and elapsed_time > timeout:
                  raise exception.TimeOut("The request timed out.")
              time.sleep(CONFIG.HNV.retry_interval)
          else:
              self._reset_model(response)
          return self