def _cache_ops_associate(protocol, msgtype):
    """https://github.com/thom311/libnl/blob/libnl3_2_25/lib/cache_mngt.c#L111.

    Positional arguments:
    protocol -- Netlink protocol (integer).
    msgtype -- Netlink message type (integer).

    Returns:
    nl_cache_ops instance with matching protocol containing matching msgtype or None.
    """
    ops = cache_ops
    while ops:  # Loop until `ops` is None.
        if ops.co_protocol == protocol:
            for co_msgtype in ops.co_msgtypes:
                if co_msgtype.mt_id == msgtype:
                    return ops
        ops = ops.co_next
    return None