def nla_find(head, len_, attrtype):
    """Find a single attribute in a stream of attributes.

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

    Iterates over the stream of attributes and compares each type with the type specified. Returns the first attribute
    which matches the type.

    Positional arguments:
    head -- first nlattr with more in its bytearray payload (nlattr class instance).
    len_ -- length of attributes stream (integer).
    attrtype -- attribute type to look for (integer).

    Returns:
    Attribute found (nlattr class instance) or None.
    """
    rem = c_int()
    for nla in nla_for_each_attr(head, len_, rem):
        if nla_type(nla) == attrtype:
            return nla
    return None