def nl_msgtype_lookup(ops, msgtype):
    """Lookup message type cache association.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/cache_mngt.c#L189

    Searches for a matching message type association ing the specified cache operations.

    Positional arguments:
    ops -- cache operations (nl_cache_ops class instance).
    msgtype -- Netlink message type (integer).

    Returns:
    A message type association or None.
    """
    for i in ops.co_msgtypes:
        if i.mt_id == msgtype:
            return i
    return None