Implement __len__ and __nonzero__ where appropriate.

This allows named fields to be tested e.g.
if m.pid.ssn_number_patient: ...