code: def test_lazy_import():
      old_sys_path = sys.path
      mock_mod = textwrap.dedent(
          """
          __version__ = '0.1.0b1'
          """.strip()
      )
      mock_mod2 = textwrap.dedent(
          """
          from mars.utils import lazy_import
          mock_mod = lazy_import("mock_mod")
  
          def get_version():
              return mock_mod.__version__
          """
      )
  
      temp_dir = tempfile.mkdtemp(prefix="mars-utils-test-")
      sys.path += [temp_dir]
      try:
          with open(os.path.join(temp_dir, "mock_mod.py"), "w") as outf:
              outf.write(mock_mod)
          with open(
              os.path.join(temp_dir, "mock_mod2.py"), "w"
          ) as outf:
              outf.write(mock_mod2)
  
          non_exist_mod = utils.lazy_import(
              "non_exist_mod", locals=locals()
          )
          assert non_exist_mod is None
  
          non_exist_mod1 = utils.lazy_import(
              "non_exist_mod1", placeholder=True
          )
          with pytest.raises(AttributeError) as ex_data:
              non_exist_mod1.meth()
          assert "required" in str(ex_data.value)
  
          mod = utils.lazy_import(
              "mock_mod",
              globals=globals(),
              locals=locals(),
              rename="mod",
          )
          assert mod is not None
          assert mod.__version__ == "0.1.0b1"
  
          glob = globals().copy()
          mod = utils.lazy_import(
              "mock_mod", globals=glob, locals=locals(), rename="mod"
          )
          glob["mod"] = mod
          assert mod is not None
          assert mod.__version__ == "0.1.0b1"
          assert type(glob["mod"]).__name__ == "module"
  
          import mock_mod2 as mod2
  
          assert type(mod2.mock_mod).__name__ != "module"
          assert mod2.get_version() == "0.1.0b1"
          assert type(mod2.mock_mod).__name__ == "module"
      finally:
          shutil.rmtree(temp_dir)
          sys.path = old_sys_path
          sys.modules.pop("mock_mod", None)
          sys.modules.pop("mock_mod2", None)
  
imports: import asyncio
  import copy
  import logging
  import multiprocessing
  import os
  import shutil
  import sys
  import tempfile
  import textwrap
  import time
  from concurrent.futures import ThreadPoolExecutor
  from functools import partial
  from io import BytesIO
  from enum import Enum
  import numpy
  import pandas
  import pytest
  from ..None import dataframe
  from ..None import tensor
  from ..None import utils
  from ..core import tile, TileableGraph
  from .core import require_ray, require_cudf
label_desc: Use image node_id 3 for calling a global function with example usage: test_lazy_import() without return types