I'm developing a class which can be meaningfully pickled only using protocol 2 (and upwards on Python 3.) When an older protocol is used, hard-to-trace bugs happen. I want to save the users of the class some debugging pain, so I want the class to immediately raise an exception if it's being pickled with a protocol of less than 2.
How can I do that?