def _extract_variables(self, realization) -> Mapping[str, str]:
    """Extracts the values of variables from a string realization based on a format string.

    Args:
      realization: The concrete string with actual values in place of variables.

    Returns:
      A dictionary mapping variable names to their extracted values.
    """

    # Escape special characters in the format string
    escaped_format = re.escape(self._multi_action_formatting_string)

    pattern = escaped_format.replace(r'\{', r'(?P<').replace(r'\}', r'>.*)')

    # Match the realization against the pattern
    match = re.match(pattern, realization)

    if match:
      # Extract the values from the named capture groups
      return match.groupdict()
    else:
      return {}
Extracts the values of variables from a string realization based on a format string.

    Args:
      realization: The concrete string with actual values in place of variables.

    Returns:
      A dictionary mapping variable names to their extracted values.
    
concordia/contrib/components/game_master/deprecated/bargain_payoffs_multi_item.py