Here's a python library I made to do it.
It's basically one for one what cc does when it saves. I've used it to do various things but editing events isn't really a simple thing to do, because .cap files don't store ACEs in a way that's easy to use. It's mainly just numbers and in order to decode it you need to be able to load the plugins to get at the text and such, but I haven't found a good way to do that yet.