  def BlockOperation(
      self, response: Dict[str, Any],
      zone: Optional[str] = None) -> Dict[str, Any]:
    """Block until API operation is finished.

    Args:
      response (Dict): GCE API response.
      zone (str): Optional. GCP zone to execute the operation in. None means
          GlobalZone.

    Returns:
      Dict: Holding the response of a get operation on an API object of type
          zoneOperations or globalOperations.

    Raises:
      RuntimeError: If API call failed.
    """

    service = self.GceApi()
    while True:
      if zone:
        request = service.zoneOperations().get( # pylint: disable=no-member
            project=self.project_id, zone=zone, operation=response['name'])
        result = request.execute()  # type: Dict[str, Any]
      else:
        request = service.globalOperations().get( # pylint: disable=no-member
            project=self.project_id, operation=response['name'])
        result = request.execute()

      if 'error' in result:
        raise RuntimeError(result['error'])

      if result['status'] == 'DONE':
        return result
      time.sleep(5)  # Seconds between requests
Block until API operation is finished.

Args:
response (Dict): GCE API response.
zone (str): Optional. GCP zone to execute the operation in. None means
GlobalZone.

Returns:
Dict: Holding the response of a get operation on an API object of type
zoneOperations or globalOperations.

Raises:
RuntimeError: If API call failed.
libcloudforensics/providers/gcp/internal/common.py