code: def event_topic_factory(
      interface_class: Type[T],
      fn_notify_event: Callable[[EventRecord], None],
  ) -> T:
      """Constructs a proxy instance of the event interface, as required by EventService and LogStatsAggregator.
  
      :param interface_class: The class object of an abstract interface that defines the events as methods.
      :param fn_notify_event: The proxy forwards all method invocations to fn_notify_event
      :return: A proxy object, dynamically derived from the passed `interface_class`.
      """
  
      # dynamically create a derived proxy class
      proxy_name = interface_class.__name__ + "Proxy"
      proxy_class = type(proxy_name, (interface_class,), dict())
      proxy = proxy_class()
  
      # implement the interface methods
      for name in dir(interface_class):
          # skip hidden attributes
          if name.startswith("_"):
              continue
  
          attr = getattr(interface_class, name)
  
          # only interested in class methods
          if not callable(attr):
              continue
  
          setattr(
              proxy,
              name,
              _recorder_factory(
                  interface_class,
                  interface_method=attr,
                  fn_notify_event=fn_notify_event,
              ),
          )
  
      return proxy
  
imports: import inspect
  from typing import TypeVar, Type, Callable
  from maze.core.events.event_record import EventRecord
label_desc: Use image node_id 1 for calling a global function with example usage: event_topic_factory(interface_class, fn_notify_event) and returns: proxy