def nlmsg_convert(hdr):
nm = nlmsg_alloc(hdr.nlmsg_len)<EOL>if not nm:<EOL><INDENT>return None<EOL><DEDENT>nm.nm_nlh.bytearray = hdr.bytearray.copy()[:hdr.nlmsg_len]<EOL>return nm<EOL>
Convert a Netlink message received from a Netlink socket to an nl_msg.

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

    Allocates a new Netlink message and copies all of the data in `hdr` into the new message object.

    Positional arguments:
    hdr -- Netlink message received from netlink socket (nlmsghdr class instance).

    Returns:
    Newly allocated Netlink message (nl_msg class instance) or None.