Iterate over a stream of attributes.

    https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L262

    Positional arguments:
    head -- first nlattr with more in its bytearray payload (nlattr class instance).
    len_ -- length of attribute stream (integer).
    rem -- initialized to len, holds bytes currently remaining in stream (c_int).

    Returns:
    Generator yielding nlattr instances.

def nla_for_each_attr(head, len_, rem):
    """Iterate over a stream of attributes.

    https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L262

    Positional arguments:
    head -- first nlattr with more in its bytearray payload (nlattr class instance).
    len_ -- length of attribute stream (integer).
    rem -- initialized to len, holds bytes currently remaining in stream (c_int).

    Returns:
    Generator yielding nlattr instances.
    """
    pos = head
    rem.value = len_
    while nla_ok(pos, rem):
        yield pos
        pos = nla_next(pos, rem)