def METHOD_NAME(events, name: str, input_shapes: str = "", attributes: str = ""):
    for item in events:
        if isinstance(item, CustomEvent):
            if item.name == name:
                return item
        if isinstance(item, KernelEvent):
            if (
                item.name == name
                and item.input_shapes == input_shapes
                and item.attributes == attributes
            ):
                return item
    return None