code: def _instantiate(self, module, class_name,
                       args=None, kwargs=None, static=None):
          
          if args is None:
              args = []
          if kwargs is None:
              kwargs = {}
          if static is None:
              static = False
  
          _check_type('args', args, list)
          _check_type('kwargs', kwargs, dict)
  
          if static and class_name is None:
              return module
  
          if static and class_name is not None:
              return getattr(module, class_name)
  
          service_obj = getattr(module, class_name)
  
          # Replace scalars
          args = self._replace_scalars_in_args(args)
          kwargs = self._replace_scalars_in_kwargs(kwargs)
  
          # Replace service references
          args = self._replace_services_in_args(args)
          kwargs = self._replace_services_in_kwargs(kwargs)
  
          # Instantiate object
          return service_obj(*args, **kwargs)
docs: Instantiates a class if provided