code: def wait_for_crm_operation(operation):
      
      logger.info("wait_for_crm_operation: "
                  "Waiting for operation {} to finish...".format(operation))
  
      for _ in range(MAX_POLLS):
          result = crm.operations().get(name=operation["name"]).execute()
          if "error" in result:
              raise Exception(result["error"])
  
          if "done" in result and result["done"]:
              logger.info("wait_for_crm_operation: Operation done.")
              break
  
          time.sleep(POLL_INTERVAL)
  
      return result
docs: Poll for cloud resource manager operation until finished.