code: def Coerce(type, message="Not a valid {} value"):
      
      @wraps(Coerce)
      def built(value):
          try:
              return type(value)
          except (TypeError, ValueError) as e:
              raise Error(message.format(type.__name__))
      return built
docs: Creates a validator that attempts to coerce the given value to the
      specified ``type``. Will raise an error if the coercion fails.
  
      A custom message can be specified with ``message``.