private SecureUtils.K2Output getMatchingK2Output(@NonNull final NetworkKey networkKey, final int nid) {
        if (nid == networkKey.getDerivatives().getNid())
            return networkKey.getDerivatives();
        else if (networkKey.getOldDerivatives() != null && nid == networkKey.getOldDerivatives().getNid())
            return networkKey.getOldDerivatives();
        return null;
    }
Returns the K2output for a given Network Key matching the received NID

@param networkKey NetworkKey
@param nid        NID
@return {@link SecureUtils.K2Output} or null if the NID doesn't match.
mesh/src/main/java/no/nordicsemi/android/mesh/transport/BaseMeshMessageHandler.java