def outcome_summary_fn(
    # `binary_joint_action` should be type Mapping[str, bool] (ie bool not int).
    joint_action: Mapping[str, str],
    rewards: Mapping[str, float],
) -> Mapping[str, str]:
  """Summarize the outcome of a decision scene."""

  if 'reject' in joint_action.values():
    outcome_str = " couldn't agree on a price and the deal fell through."
  else:
    outcome_str = ' agreed on a price and the deal was successful!'

  results = {}
  buyer_and_seller = ' and '.join(joint_action.keys())
  for name, score in rewards.items():
    if score > 0:
      results[name] = (
          f'{buyer_and_seller}{outcome_str} {name} stands to make profit of'
          f' {score} coins from the deal.'
      )
    else:
      results[name] = (
          f'{buyer_and_seller}{outcome_str} However, {name} stands to lose'
          f' {-score} coins from the deal.'
      )
    print(results[name])

  return results
Summarize the outcome of a decision scene.
examples/deprecated/modular/environment/haggling_multi_item.py