class_docstr: A wrapper class that allows for easy interaction with a Study.
docstr: Returns whether trial should stop early.
  
  Args:
      trial_id: trial_id.
  
  Returns:
      Whether it is recommended to stop the trial early.
docstr_tok: ["Returns","whether","trial","should","stop","early",".","Args",":","trial_id",":","trial_id",".","Returns",":","Whether","it","is","recommended","to","stop","the","trial","early","."]
code: def should_trial_stop(self, trial_id: Text) -> bool:
      """Returns whether trial should stop early.
  
      Args:
          trial_id: trial_id.
  
      Returns:
          Whether it is recommended to stop the trial early.
      """
      trial_name = self._make_trial_name(trial_id)
      try:
          resp = (
              self.service_client.projects()
              .locations()
              .studies()
              .trials()
              .checkEarlyStoppingState(name=trial_name)
              .execute()
          )
      except errors.HttpError as e:
          tf.get_logger().info("CheckEarlyStoppingState failed.")
          raise e
      # Polls the stop decision of long-running operations.
      operation = self._obtain_long_running_operation(resp)
  
      tf.get_logger().info("CheckEarlyStoppingStateResponse")
      if operation["response"].get("shouldStop"):
          # Stops a trial.
          try:
              tf.get_logger().info("Stop the Trial.")
              self.service_client.projects().locations().studies().trials().stop(
                  name=trial_name
              ).execute()
          except errors.HttpError as e:
              tf.get_logger().info("StopTrial failed.")
              raise e
          return True
      return False
  
imports: import datetime
  import http
  import json
  import time
  from typing import Any, Dict, List, Mapping, Optional, Text, Union
  from googleapiclient import discovery
  from googleapiclient import errors
  import tensorflow
  from tensorflow_cloud.tuner import vizier_client_interface
  from tensorflow_cloud.tuner import constants
  from tensorflow_cloud.utils import google_api_client
label_desc: Use image node_id 4 for calling the _VizierClient obj's underlying member method code with example usage: obj.should_trial_stop(trial_id) and returns: False, True