def nla_ok(nla, remaining):
    """Check if the attribute header and payload can be accessed safely.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L148

    Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function
    must be called before access the attribute header or payload when iterating over the attribute stream using
    nla_next().

    Positional arguments:
    nla -- attribute of any kind (nlattr class instance).
    remaining -- number of bytes remaining in attribute stream (c_int).

    Returns:
    True if the attribute can be accessed safely, False otherwise.
    """
    return remaining.value >= nla.SIZEOF and nla.SIZEOF <= nla.nla_len <= remaining.value
Check if the attribute header and payload can be accessed safely.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L148

    Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function
    must be called before access the attribute header or payload when iterating over the attribute stream using
    nla_next().

    Positional arguments:
    nla -- attribute of any kind (nlattr class instance).
    remaining -- number of bytes remaining in attribute stream (c_int).

    Returns:
    True if the attribute can be accessed safely, False otherwise.