https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/list.h#L79.

    Positional arguments:
    pos -- class instance holding an nl_list_head instance.
    head -- nl_list_head class instance.
    member -- attribute (string).

    Returns:
    Generator yielding a class instances.

def nl_list_for_each_entry(pos, head, member):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/list.h#L79.

    Positional arguments:
    pos -- class instance holding an nl_list_head instance.
    head -- nl_list_head class instance.
    member -- attribute (string).

    Returns:
    Generator yielding a class instances.
    """
    pos = nl_list_entry(head.next_, type(pos), member)
    while True:
        yield pos
        if getattr(pos, member) != head:
            pos = nl_list_entry(getattr(pos, member).next_, type(pos), member)
            continue
        break