https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L908.

    Positional arguments:
    msg -- message to print (nl_msg class instance).

    Keyword arguments:
    ofd -- function to call with arguments similar to `logging.debug`.

def dump_error_msg(msg, ofd=_LOGGER.debug):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L908.

    Positional arguments:
    msg -- message to print (nl_msg class instance).

    Keyword arguments:
    ofd -- function to call with arguments similar to `logging.debug`.
    """
    hdr = nlmsg_hdr(msg)
    err = libnl.linux_private.netlink.nlmsgerr(nlmsg_data(hdr))

    ofd('  [ERRORMSG] %d octets', err.SIZEOF)

    if nlmsg_len(hdr) >= err.SIZEOF:
        ofd('    .error = %d "%s"', err.error, os.strerror(-err.error))
        ofd('  [ORIGINAL MESSAGE] %d octets', hdr.SIZEOF)
        errmsg = nlmsg_inherit(err.msg)
        print_hdr(ofd, errmsg)