code: def validate_type(self, type_):
          
          if type_ is not None and type_ not in self.types_set:
              raise ValueError('Invalid type for %s:%s' % (self.__class__, type_))
docs: Take an str/unicode `type_` and raise a ValueError if it's not 
          a valid type for the object.
          
          A valid type for a field is a value from the types_set attribute of 
          that field's class.