def is_type(valid_type):
def validate(value, should_raise=True):<EOL><INDENT>if not isinstance(value, valid_type):<EOL><INDENT>if should_raise:<EOL><INDENT>raise TypeError("<STR_LIT>".format(<EOL>expected=valid_type, actual=type(value)))<EOL><DEDENT>return False<EOL><DEDENT>return True<EOL><DEDENT>return validate<EOL>
Returns a validator function that succeeds only for inputs of the provided valid_type.

    :param type valid_type: the type that should be considered valid for the validator
    :returns: a function which returns True its input is an instance of valid_type, and raises TypeError otherwise
    :rtype: callable