code: def _wait_for_operation(self, operation, locality="zone"):
      self.logger.debug(
          "Waiting for operation {} to finish...".format(operation)
      )
      while True:
          if locality == "zone":
              result = (
                  self.compute.zoneOperations()
                  .get(
                      project=self.projectid,
                      zone=self.zone,
                      operation=operation,
                  )
                  .execute()
              )
          elif locality == "global":
              result = (
                  self.compute.globalOperations()
                  .get(project=self.projectid, operation=operation)
                  .execute()
              )
          else:
              raise ValueError(
                  (
                      "Unknown locality {} "
                      + "should be zone or global".format(locality)
                  )
              )
  
          if result["status"] == "DONE":
              self.logger.debug("done.")
              if "error" in result:
                  raise Exception(result["error"])
              return result
  
          time.sleep(1)
  
imports: import os
  import time
  import googleapiclient.discovery
  import uuid
  import math
  import json
  from studio import git_util
  from studio.util import logs
  from studio.util.gpu_util import memstr2int
  from .cloud_worker_util import insert_user_startup_script
label_desc: Use image node_id 10 for calling the GCloudWorkerManager obj's underlying member method code with example usage: obj._wait_for_operation(operation, locality) and returns: result