def nl_list_for_each_entry_safe(pos, n, head, member):
pos = nl_list_entry(head.next_, type(pos), member)<EOL>n = nl_list_entry(pos.member.next_, type(pos), member)<EOL>while True:<EOL><INDENT>yield pos<EOL>if getattr(pos, member) != head:<EOL><INDENT>pos = n<EOL>n = nl_list_entry(n.member.next_, type(n), member)<EOL>continue<EOL><DEDENT>break<EOL><DEDENT>
https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/list.h#L84.

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

    Returns:
    Generator yielding a class instances.