Set up an error callback. Updates `cb` in place.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L343

    Positional arguments:
    cb -- nl_cb class instance.
    kind -- kind of callback (integer).
    func -- callback function.
    arg -- argument to be passed to callback function.

    Returns:
    0 on success or a negative error code.

def nl_cb_err(cb, kind, func, arg):
    """Set up an error callback. Updates `cb` in place.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L343

    Positional arguments:
    cb -- nl_cb class instance.
    kind -- kind of callback (integer).
    func -- callback function.
    arg -- argument to be passed to callback function.

    Returns:
    0 on success or a negative error code.
    """
    if kind < 0 or kind > NL_CB_KIND_MAX:
        return -NLE_RANGE

    if kind == NL_CB_CUSTOM:
        cb.cb_err = func
        cb.cb_err_arg = arg
    else:
        cb.cb_err = cb_err_def[kind]
        cb.cb_err_arg = arg

    return 0