creates type wrapper for non-null of given type

def _create_non_null_wrapper(name, t):
    'creates type wrapper for non-null of given type'
    def __new__(cls, json_data, selection_list=None):
        if json_data is None:
            raise ValueError(name + ' received null value')
        return t(json_data, selection_list)

    def __to_graphql_input__(value, indent=0, indent_string='  '):
        return t.__to_graphql_input__(value, indent, indent_string)

    return type(name, (t,), {
        '__new__': __new__,
        '_%s__auto_register' % name: False,
        '__to_graphql_input__': __to_graphql_input__,
    })