Make __getstate__ work for derived classes

Expand `AffineScalarFunc.__getstate__` to work for all slots in the inheritance hierarchy. This removes the need for `Variable` to have a `__getstate__` method too.
Support subclasses without __slots__

If AffineScalarFunc was subclassed by a class that does not use `__slots__` the instance would have a `__dict__`. Support that case.
Merge pull request #13 from mjpieters/master

Subclasses are more easily pickled, now. The pickling code is now also simpler.