def nl_complete_msg(sk, msg):
nlh = msg.nm_nlh<EOL>if nlh.nlmsg_pid == NL_AUTO_PORT:<EOL><INDENT>nlh.nlmsg_pid = nl_socket_get_local_port(sk)<EOL><DEDENT>if nlh.nlmsg_seq == NL_AUTO_SEQ:<EOL><INDENT>nlh.nlmsg_seq = sk.s_seq_next<EOL>sk.s_seq_next += <NUM_LIT:1><EOL><DEDENT>if msg.nm_protocol == -<NUM_LIT:1>:<EOL><INDENT>msg.nm_protocol = sk.s_proto<EOL><DEDENT>nlh.nlmsg_flags |= NLM_F_REQUEST<EOL>if not sk.s_flags & NL_NO_AUTO_ACK:<EOL><INDENT>nlh.nlmsg_flags |= NLM_F_ACK<EOL><DEDENT>
Finalize Netlink message.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L450

    This function finalizes a Netlink message by completing the message with desirable flags and values depending on the
    socket configuration.

    - If not yet filled out, the source address of the message (`nlmsg_pid`) will be set to the local port number of the
      socket.
    - If not yet specified, the next available sequence number is assigned to the message (`nlmsg_seq`).
    - If not yet specified, the protocol field of the message will be set to the protocol field of the socket.
    - The `NLM_F_REQUEST` Netlink message flag will be set.
    - The `NLM_F_ACK` flag will be set if Auto-ACK mode is enabled on the socket.

    Positional arguments:
    sk -- Netlink socket (nl_sock class instance).
    msg -- Netlink message (nl_msg class instance).