code: def _safe_eval(metric_str):
      code = compile(metric_str, "<string>", "eval")
      for name in code.co_names:
          if name not in ALLOWED_METRIC_NAMES:
              raise NameError(f"Use of {name} not allowed")
      return eval(code, {"__builtins__": {}}, ALLOWED_METRIC_NAMES)
  
file_path: cornac/cornac/serving/app.py
imports: import os
  import sys
  import inspect
  from datetime import datetime, timezone
  from csv import writer
  from cornac.data import Dataset, Reader
  from cornac.eval_methods import BaseMethod
  from cornac.metrics import *
label_desc: Use image node_id 1 for calling a global function with example usage: _safe_eval(metric_str) and returns: eval