code: def error(self, instance, value, error_class=None, extra=''):
          
          error_class = error_class or ValidationError
          prefix = 'The {} property'.format(self.__class__.__name__)
          if self.name != '':
              prefix = prefix + " '{}'".format(self.name)
          if instance is not None:
              prefix = prefix + ' of a {cls} instance'.format(
                  cls=instance.__class__.__name__,
              )
          print_value = repr(value)
          if len(print_value) > 107:
              print_value = '{}  ...  {}'.format(
                  print_value[:50], print_value[-50:]
              )
          message = (
              '{prefix} must be {info}. An invalid value of {val} {vtype} was '
              'specified.{extra}'.format(
                  prefix=prefix,
                  info=self.info or 'corrected',
                  val=print_value,
                  vtype=type(value),
                  extra=' {}'.format(extra) if extra else '',
              )
          )
          if issubclass(error_class, ValidationError):
              raise error_class(message, 'invalid', self.name, instance)
          raise error_class(message)
docs: Generate a :code:`ValueError` for invalid value assignment
  
          The instance is the containing HasProperties instance, but it may
          be None if the error is raised outside a HasProperties class.