code: def rollback(self, revision=None, annotations=None):
          
  
          rollback = DeploymentRollback()
          rollback.name = self.name
  
          rollback_config = RollbackConfig()
  
          # to the specified revision
          if revision is not None:
              rollback_config.revision = revision
          # to the revision immediately preceding the current revision
          else:
              current_revision = int(self.get_annotation(self.REVISION_ANNOTATION))
              rev = max(current_revision - 1, 0)
              rollback_config.revision = rev
  
          rollback.rollback_to = rollback_config
  
          if annotations is not None:
              rollback.updated_annotations = annotations
  
          url = '{base}/{name}/rollback'.format(base=self.base_url, name=self.name)
          state = self.request(
              method='POST',
              url=url,
              data=rollback.serialize())
  
          if not state.get('success'):
              status = state.get('status', '')
              reason = state.get('data', dict()).get('message', None)
              message = 'K8sDeployment: ROLLBACK failed : HTTP {0} : {1}'.format(status, reason)
              raise BadRequestException(message)
  
          time.sleep(0.2)
          self._wait_for_desired_replicas()
          self.get()
  
          return self
docs: Performs a rollback of the Deployment.
  
          If the 'revision' parameter is omitted, we fetch the Deployment's system-generated
          annotation containing the current revision, and revert to the version immediately
          preceding the current version.
  
          :param revision: The revision to rollback to.
          :param annotations: Annotations we'd like to update.
          :return: self