code: def goals_hit_helper(
      goals: List[Dict], turnDict: List[Dict], permissive=False
  ) -> (AverageMetric, AverageMetric, AverageMetric):
      """
      Helper function that aids in seeing if the API calls the system has attempted to
      make manages to meet the goals the conversation has.
  
      Return values:
      * if all goals hit
      * # of turns it took to hit all goals (or None)
      * fraction of goals hit
      """
      goals_left = goals
  
      def exact_match(goal, turn):  # if and only if
          return goal == turn
  
      def permissive_match(goal, turn):  # guess is superset
          for key in goal:
              if turn.get(key, "definitelyNotIn") != goal[key]:
                  return False
          return True
  
      compare_func = permissive_match if permissive else exact_match
  
      for i, turn in enumerate(turnDict):
          goals_left = [
              goal
              for goal in goals_left
              if not compare_func(goal, turn)
          ]
          if len(goals_left) == 0:
              return (
                  AverageMetric(True),
                  AverageMetric(i + 1),
                  AverageMetric(1),
              )
      return (
          AverageMetric(False),
          AverageMetric(0),
          AverageMetric(len(goals) - len(goals_left), len(goals)),
      )
  
imports: from parlai.core.message import Message
  from parlai.core.metrics import Metric, AverageMetric
  from parlai.core.tod.tod_core import STANDARD_DONE
  from typing import Dict, List, Optional
label_desc: Use image node_id 2 for calling a global function with example usage: goals_hit_helper(goals, turnDict, permissive) and returns: AverageMetric,  AverageMetric,  AverageMetric, unknown, True, AverageMetric,  AverageMetric,  AverageMetric, False