Support serialization of attributes

Adds a "getstate" function on attributes, which will be called when
the Schema's __getstate__() method is called.  This allows an
attribute to be converted into some special form, if desired.  For
instance, an application may convert an attribute which stores a
datetime into an ISO-8601-compliant string when the object is
serialized for storage or transfer; the corresponding validation
function may then parse the string back into a datetime.