code: def assert_time(f, max_duration):
      start = timer()
      x = f()
      end = timer()
      assert (start - end) < max_duration
      print(f"took {end - start:.3f}")
      return x
  
imports: from typing import Callable, TypeVar
  from typing_extensions import ParamSpec
  import os
  from timeit import default_timer
  import unittest
  import pytest
  from hailtop.hail_decorator import decorator
  from hail.utils.java import choose_backend
  import hail
label_desc: Use image node_id 8 for calling a global function with example usage: assert_time(f, max_duration) and returns: x