I am posting this as what I'm using in the meanwhile, but ideally it would be a method attribute of the class. The fibers() method is quite helpful here. It gives a dictionary of preimages of each element. Since we have singletons we just pop() and we know it's the inverse element.
> def inverse(func):