Class decorator for immutable objects in python