import json


def _extract_run_result(request_body):
  """Extracts run results from the request body came from Cloud Pub/Sub.

  Args:
    request_body: dict, a request body came from Cloud Pub/Sub.

  Returns:
    a dict containing the result of a run.
  """
  run_results_str = request_body.get('message',
                                     {}).get('attributes',
                                             {}).get('content_api_results',
                                                     '{}')
  run_results_dict = json.loads(run_results_str.decode('utf-8'))
  return run_results_dict