code: def eval_timed(expression):
      """Evaluate a Hail expression, returning the result and the times taken for
      each stage in the evaluation process.
  
      Parameters
      ----------
      expression : :class:`.Expression`
          Any expression, or a Python value that can be implicitly interpreted as an expression.
  
      Returns
      -------
      (Any, dict)
          Result of evaluating `expression` and a dictionary of the timings
      """
  
      from hail.utils.java import Env
  
      analyze("eval", expression, Indices(expression._indices.source))
      if expression._indices.source is None:
          ir_type = expression._ir.typ
          expression_type = expression.dtype
          if ir_type != expression.dtype:
              raise ExpressionException(
                  f"Expression type and IR type differed: \n{ir_type}\n vs \n{expression_type}"
              )
          ir = expression._ir
      else:
          uid = Env.get_uid()
          ir = (
              expression._indices.source.select_globals(
                  **{uid: expression}
              )
              .index_globals()[uid]
              ._ir
          )
  
      return Env.backend().execute(MakeTuple([ir]), timed=True)[0]
  
file_path: hail/hail/python/hail/expr/expressions/expression_utils.py
imports: from typing import Set, Dict
  from hail.typecheck import typecheck, setof
  from .indices import Indices, Aggregation
  from ..expressions import Expression, ExpressionException, expr_any
  from ...ir import MakeTuple
label_desc: Use image node_id 2 for calling a global function with example usage: eval_timed(expression) and returns: Env