code: def wait_for_extended_operation(
      operation: ExtendedOperation,
      verbose_name: str = "operation",
      timeout: int = 300,
  ):
      result = operation.result(timeout=timeout)
  
      if operation.error_code:
          logger.error(
              "Error during %s: [Code: %s]: %s",
              verbose_name,
              operation.error_code,
              operation.error_message,
          )
          logger.error("Operation ID: %s", operation.name)
          raise operation.exception() or RuntimeError(
              operation.error_message
          )
  
      return result
  
file_path: dstack/src/dstack/_internal/core/backends/gcp/resources.py
imports: from typing import Dict, List, Optional
  import google.api_core.exceptions
  import google.cloud.compute_v1
  from google.api_core.extended_operation import ExtendedOperation
  import dstack.version
  from dstack._internal.core.models.instances import Gpu
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 7 for calling a global function with example usage: wait_for_extended_operation(operation, verbose_name, timeout) and returns: result