Iterate over a stream of nested attributes.

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

    Positional arguments:
    nla -- attribute containing the nested attributes (nlattr class instance).
    rem -- initialized to len, holds bytes currently remaining in stream (c_int).

    Returns:
    Generator yielding nlattr instances.

def nla_for_each_nested(nla, rem):
    """Iterate over a stream of nested attributes.

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

    Positional arguments:
    nla -- attribute containing the nested attributes (nlattr class instance).
    rem -- initialized to len, holds bytes currently remaining in stream (c_int).

    Returns:
    Generator yielding nlattr instances.
    """
    pos = nlattr(nla_data(nla))
    rem.value = nla_len(nla)
    while nla_ok(pos, rem):
        yield pos
        pos = nla_next(pos, rem)