def nl_list_entry(ptr, type_, member):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/list.h#L64"""
    if ptr.container_of:
        return ptr.container_of
    null_data = type_()
    setattr(null_data, member, ptr)
    return null_data
