import ast


def ParseTryjobBuildbucketId(msg):
  """Find the buildbucket-id in the messages from `cros tryjob`.

  Args:
    msg: messages from `cros tryjob`

  Returns:
    buildbucket-id, which will be passed to `cros buildresult`
  """
  output_list = ast.literal_eval(msg)
  output_dict = output_list[0]
  if 'buildbucket_id' in output_dict:
    return output_dict['buildbucket_id']
  return None