code: def import_object(string: str):
      """Import an object from a string.
  
      The object can be a function, class or method.
      For example: `'keras.layers.Dense.get_weights'` is valid.
      """
      last_object_got = None
      seen_names = []
      for name in string.split("."):
          seen_names.append(name)
          try:
              last_object_got = importlib.import_module(
                  ".".join(seen_names)
              )
          except ModuleNotFoundError:
              last_object_got = getattr(last_object_got, name)
      return last_object_got
  
file_path: autokeras/docs/keras_autodoc/utils.py
imports: import importlib
  import inspect
  import os
  import re
label_desc: Use image node_id 8 for calling a global function with example usage: import_object(string) and returns: last_object_got