def check_type(self, value):
    """
    Raises a #TypeError if *value* is not an instance of the field's #type.
    """

    if self.null and value is None:
      return
    if self.type is not None and not isinstance(value, self.type):
      msg = '{0!r} expected type {1}'
      raise TypeError(msg.format(self.full_name, self.type.__name__))