code: def validate_wrap(self, value):
          ''' Checks that ``value`` is a pymongo ``ObjectId`` or a string
              representation of one'''
          if (not isinstance(value, ObjectId)
                  and not isinstance(value, basestring)
                  and not isinstance(value, bytes)
              ):
              self._fail_validation_type(value, ObjectId)
          if isinstance(value, ObjectId):
              return
          #: bytes
          if len(value) == 12:
              return
          # hex
          if len(value) != 24:
              self._fail_validation(value, 'hex object ID is the wrong length'f validate_wrap(self, value):
          ''' Checks that ``value`` is a pymongo ``ObjectId`` or a string
              representation of one'''
          if (not isinstance(value, ObjectId)
                  and not isinstance(value, basestring)
                  and not isinstance(value, bytes)
              ):
              self._fail_validation_type(value, ObjectId)
          if isinstance(value, ObjectId):
              return
          #: bytes
          if len(value) == 12:
              return
          # hex
          if len(value) != 24:
              self._fail_validation(value, 'hex object ID is the wrong length')
docs: Checks that ``value`` is a pymongo ``ObjectId`` or a string
              representation of one