code: def __init__(self, queue_name, sub_name=None, verbose=10):
      from google.cloud import pubsub
  
      assert "GOOGLE_APPLICATION_CREDENTIALS" in os.environ.keys()
      with open(os.environ["GOOGLE_APPLICATION_CREDENTIALS"]) as f:
          credentials = json.loads(f.read())
  
      project_name = credentials["project_id"]
      self.logger = logs.get_logger(self.__class__.__name__)
      if verbose is not None:
          self.logger.setLevel(parse_verbosity(verbose))
  
      self.pubclient = pubsub.PublisherClient()
      self.subclient = pubsub.SubscriberClient()
  
      self.project = project_name
      self.topic_name = self.pubclient.topic_path(
          project_name, queue_name
      )
      self.logger.info("Topic name = {}".format(self.topic_name))
      try:
          self.pubtopic = self.pubclient.get_topic(self.topic_name)
      except BaseException as e:
          check_for_kb_interrupt()
          self.pubtopic = self.pubclient.create_topic(self.topic_name)
          self.logger.info("topic {} created".format(self.topic_name))
  
      sub_name = sub_name if sub_name else queue_name + "_sub"
      self.logger.info("Topic name = {}".format(queue_name))
      self.logger.info("Subscription name = {}".format(sub_name))
  
      self.sub_name = self.subclient.subscription_path(
          project_name, sub_name
      )
      try:
          self.subclient.get_subscription(self.sub_name)
      except BaseException as e:
          check_for_kb_interrupt()
          self.logger.warn(e)
          self.subclient.create_subscription(
              self.sub_name, self.topic_name, ack_deadline_seconds=20
          )
  
      self.logger.info("subscription {} created".format(sub_name))
  
file_path: studio/studio/pubsub_queue.py
imports: import os
  import json
  import time
  from google.api_core.exceptions import RetryError
  from studio.util.util import sixdecode, retry, parse_verbosity, check_for_kb_interrupt
  from studio.util import logs
label_desc: Use image node_id 1 to create a new PubsubQueue object from inherited base classes: object with example: obj = PubsubQueue(queue_name, sub_name, verbose)