code: def nlmsg_convert(hdr):
      
      nm = nlmsg_alloc(hdr.nlmsg_len)
      if not nm:
          return None
      nm.nm_nlh.bytearray = hdr.bytearray.copy()[:hdr.nlmsg_len]
      return nm
docs: 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.