class_docstr: Manages the recording of event invocations and provides simple event routing functionality.
  There is one EventService instance in every agent-environment loop, provided by the AgentEnvironmentContext.
  
  Within the environment the richer routing functionality provided by PubSub should be utilized, rather than
  directly interacting with this class.
class_docstr_tok: ["Manages","the","recording","of","event","invocations","and","provides","simple","event","routing","functionality",".","There","is","one","EventService","instance","in","every","agent-environment","loop",",","provided","by","the","AgentEnvironmentContext",".","Within","the","environment","the","richer","routing","functionality","provided","by","PubSub","should","be","utilized",",","rather","than","directly","interacting","with","this","class","."]
docstr: Create a proxy instance of the event interface, which can be used conveniently to publish events.
  Returns an existing proxy, if it has been created before.
  
  :param interface_class: The class object of an abstract interface that defines the events as methods.
  :param scope: Every event topic can be bound to a single scope, e.g. a certain PubSub instance, to ensure
                that all events of the topic `interface_class` will be received by this PubSub instance.
  :return: A proxy object, dynamically derived from the passed `interface_class`, that can be used to trigger
           events.
docstr_tok: ["Create","a","proxy","instance","of","the","event","interface",",","which","can","be","used","conveniently","to","publish","events",".","Returns","an","existing","proxy",",","if","it","has","been","created","before",".",":","param","interface_class",":","The","class","object","of","an","abstract","interface","that","defines","the","events","as","methods",".",":","param","scope",":","Every","event","topic","can","be","bound","to","a","single","scope",",","e.g",".","a","certain","PubSub","instance",",","to","ensure","that","all","events","of","the","topic","`","interface_class","`","will","be","received","by","this","PubSub","instance",".",":","return",":","A","proxy","object",",","dynamically","derived","from","the","passed","`","interface_class","`",",","that","can","be","used","to","trigger","events","."]
code: def create_event_topic(
      self, interface_class: Type[T], scope: EventScope = None
  ) -> T:
      """
      Create a proxy instance of the event interface, which can be used conveniently to publish events.
      Returns an existing proxy, if it has been created before.
  
      :param interface_class: The class object of an abstract interface that defines the events as methods.
      :param scope: Every event topic can be bound to a single scope, e.g. a certain PubSub instance, to ensure
                    that all events of the topic `interface_class` will be received by this PubSub instance.
      :return: A proxy object, dynamically derived from the passed `interface_class`, that can be used to trigger
               events.
      """
      # return topic proxy if it already exists
      topic = self.topics.get(interface_class)
      if topic:
          assert (
              topic.scope == scope
          ), "same interface in different scopes ({} and {})".format(
              topic.scope, scope
          )
          return topic.proxy
  
      recorder = event_topic_factory(interface_class, self.notify_event)
  
      topic = self.TopicInfo(interface_class, scope, recorder)
      self.topics[interface_class] = topic
  
      if scope is not None:
          self.scopes.add(scope)
  
      return recorder
  
file_path: maze/maze/core/events/event_service.py
imports: from abc import ABC, abstractmethod
  from collections import deque
  from typing import Dict, TypeVar, Type, Set, Generator
  from maze.core.events.event_record import EventRecord
  from maze.core.events.event_topic_factory import event_topic_factory
label_desc: Use image node_id 4 for calling the EventService obj's underlying member method code with example usage: obj.create_event_topic(interface_class, scope) and returns: recorder, topic