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.
Encode bucket list item link.

Closes #207.
Ensure is_valid() behaves properly.

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

Redo of class_mapper_fixes branch.
Merge branch 'master' into distributed_services