code: def as_event_class(obj):
      
      if is_string(obj):
          for c in all_subclasses(AbinitEvent):
              if c.__name__ == obj or c.yaml_tag == obj: return c
          raise ValueError("Cannot find event class associated to %s" % obj)
  
      # Assume class.
      assert obj in all_subclasses(AbinitEvent)
      return obj
docs: Convert obj into a subclass of AbinitEvent.
      obj can be either a class or a string with the class name or the YAML tag