<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nl_cb_set(cb, type_, kind, func, arg):
 """Set up a callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L293 Positional arguments: cb -- nl_cb class instance. type_ -- callback to modify (integer). kind -- kind of implementation (integer). func -- callback function (NL_CB_CUSTOM). arg -- argument passed to callback. Returns: 0 on success or a negative error code. """

    if type_ < 0 or type_ > NL_CB_TYPE_MAX or kind < 0 or kind > NL_CB_KIND_MAX:
        return -NLE_RANGE

    if kind == NL_CB_CUSTOM:
        cb.cb_set[type_] = func
        cb.cb_args[type_] = arg
    else:
        cb.cb_set[type_] = cb_def[type_][kind]
        cb.cb_args[type_] = arg

    return 0