def type_check_and_str(python_type, value):
    """Type-check the value, and then just return str(value)."""
    if not isinstance(value, python_type):
        raise GraphQLInvalidArgumentError(u'Attempting to represent a non-{type} as a {type}: '
                                          u'{value}'.format(type=python_type, value=value))

    return str(value)
Type-check the value, and then just return str(value).