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

    Args:
      response (Dict): Google Cloud Build API response.

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

    Raises:
      RuntimeError: If the Cloud Build failed or if getting the Cloud Build
          API operation object failed.
    """
    while True:
      response = self._RetryExecuteRequest(response['name'])
      if response.get('done') and response.get('error'):
        build_metadata = response['metadata']['build']
        raise RuntimeError(
            ': {0:1}, logs bucket: {1:s}, logs URL: {2:s}'.format(
                response['error']['message'],
                build_metadata['logsBucket'],
                build_metadata['logUrl']))

      if response.get('done') and response.get('response'):
        return response
      time.sleep(5)  # Seconds between requests
Block execution until API operation is finished.

Args:
response (Dict): Google Cloud Build API response.

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

Raises:
RuntimeError: If the Cloud Build failed or if getting the Cloud Build
API operation object failed.
libcloudforensics/providers/gcp/internal/build.py