@classmethod<EOL><INDENT>def _ensure_object_id(cls, id):<DEDENT>
if isinstance(id, ObjectId):<EOL><INDENT>return id<EOL><DEDENT>if isinstance(id, basestring) and OBJECTIDEXPR.match(id):<EOL><INDENT>return ObjectId(id)<EOL><DEDENT>return id<EOL>
Checks whether the given id is an ObjectId instance, and if not wraps it.