import ast
import timeit


def time_tree(tree: ast.AST):
  """
  Time ast execution

  :param tree: AST tree
  :return: float recording number of seconds to run snippet
  """
  return timeit.timeit(stmt="exec(compile(tree, 'test', mode='exec'))", number=10000, globals={'tree': tree})