but the implementation is pretty ugly :( - I didn't write C extensions for Python before, and the extending exception class with some methods isn't well supported and well documented.
here is new patch
cleaned, all unwanted artefacts removed. I am not sure if used way for method registration is 100% valid, but I didn't find any related documentation.