Redo of class_mapper_fixes branch.

Instead of litering try/except blocks in class_from_value() just check
if the type is one we need an ObjectId for and make sure the value is
a valid ObjectId. Makes this easier to read at a glance.

Instead of a giant try/except block in class_from_id() just check up
front for a valid ObjectId. In this case we do not need to check the
type as all queries are done by ObjectId in this function.

Suggested by: dsnellgrove
Discussed in #213.
Ensure is_valid() behaves properly.

Suggested by: dsnellgrove
Merge pull request #216 from crits/class_fixes2

Redo of class_mapper_fixes branch.