code: def try_import_module(*, module, parent_class=None):
      try:
          module = importlib.import_module(name=module)
          assert parent_class is not None
          classes = list()
          for cls in dir(module):
              cls = getattr(module, cls)
              if isinstance(cls, type) and issubclass(
                  cls, parent_class
              ):
                  classes.append(cls)
          if len(classes) > 1:
              filter_classes = list()
              for cls in classes:
                  if not all(
                      issubclass(x, cls) for x in classes
                  ):  # check whether not super-class
                      filter_classes.append(cls)
              classes = filter_classes
          if len(classes) == 0:
              return None
          elif len(classes) > 1:
              raise TensorforceError(
                  message="Ambiguous import modules: {}".format(
                      ", ".join(str(cls) for cls in classes)
                  )
              )
          cls = classes[0]
          if isinstance(parent_class, tuple):
              assert all(
                  cls != parent_cls for parent_cls in parent_class
              )
          else:
              assert cls != parent_class
          return cls
  
      except ImportError:
          pass
  
      if "." not in module:
          return None
  
      module, class_name = module.rsplit(".", 1)
      try:
          module = importlib.import_module(name=module)
          cls = getattr(module, class_name)
          assert issubclass(cls, parent_class) and cls != parent_class
          return cls
  
      except ImportError:
          return None
  
imports: from datetime import datetime
  import importlib
  import logging
  import numpy
  import tensorflow
  from tensorforce import TensorforceError
label_desc: Use image node_id 3 for calling a global function with example usage: try_import_module() and returns: cls, None, cls, None, None