code: def check_performance(
      check_str,
      output_folder,
      recipe_id,
      pattern=r"performance_check=\[(.*?)\]",
  ):
      """Checks if the performance achieved by the recipe matches with the
      expectations. This is done by adding a performance_check entry in the recipe
      check field of the csv recipe file
      For instance: performance_check=[train_log.txt, train loss, <=15, epoch: 2]),
      will check the variable "train_loss" in the train_log.txt at epoch 2. It will
      raise an error if the train_loss is >15. If epoch is -1, we check the last
      line of the file.
  
      Arguments
      ---------
      check_str: str
          String summarizing the checks to perform.
      output_folder: path
          The path where the recipe files are stored.
      recipe_id: str
          Unique ID of the recipe.
      pattern: str
          The pattern used to extract the list of files to check from check_str.
  
      Returns
      ---------
      check: bool
          True if all the files are found, False otherwise.
      """
  
      check = True
      performance_to_check = re.search(pattern, check_str)
      if performance_to_check is None:
          return check
  
      # Getting the needed information from the "performance_check" entry
      performance_to_check = performance_to_check.group(1).split(",")
      filename = performance_to_check[0].strip()
      filename = os.path.join(output_folder, filename)
      variable = performance_to_check[1].strip()
      threshold = performance_to_check[2].strip()
      epoch = performance_to_check[3].strip()
  
      if not (os.path.exists(filename)):
          print(
              "\tERROR: The file %s of recipe %s does not exist (needed for performance checks)"
              % (filename, recipe_id)
          )
  
          return False
  
      # Real all the lines of the performance file
      with open(filename) as file:
          lines = file.readlines()
  
      # Fitler the lines
      lines_filt = []
      last_line = ""
      for line in lines:
          if len(line.strip()) > 0:
              last_line = line
          if epoch in line:
              lines_filt.append(line)
  
      # If epoch: -1, we take the last line of the file
      epoch_id = int(epoch.split(":")[-1].strip())
      if epoch_id == -1:
          lines_filt.append(last_line)
  
      # Raising an error if there are no lines after applying the filter
      if len(lines_filt) == 0:
          print(
              "\tERROR: No entries %s in %s (recipe %s). See performance_check entry."
              % (epoch, filename, recipe_id)
          )
          return False
  
      for line in lines_filt:
          # Search variable value
          var_value = extract_value(line, variable)
  
          if var_value is None:
              print(
                  "\tERROR: The file %s of recipe %s does not contain the variable %s (needed for performance checks)"
                  % (filename, recipe_id, variable)
              )
              return False
          var_value = float(var_value)
          check = check_threshold(threshold, var_value)
  
          if not (check):
              print(
                  "\tERROR: The variable %s of file %s (recipe %s) violated the specified threshold (%s %s)"
                  % (
                      variable,
                      filename,
                      recipe_id,
                      var_value,
                      threshold,
                  )
              )
  
          break
  
      return check
  
file_path: speechbrain/tests/utils/recipe_tests.py
imports: import os
  import re
  import csv
  import sys
  import pydoc
  from time import time
  import subprocess
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.data_utils import download_file
label_desc: Use image node_id 4 for calling a global function with example usage: check_performance(check_str, output_folder, recipe_id, pattern) and returns: check, check, False, False, False