def as_event_class(obj):
    """
    Convert obj into a subclass of AbinitEvent.
    obj can be either a class or a string with the class name or the YAML tag
    """
    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
Convert obj into a subclass of AbinitEvent.
    obj can be either a class or a string with the class name or the YAML tag