def METHOD_NAME(grib_message, keyname):
    """
    Fake the ecCodes type-discovery operation.
    Return type of key-value in the fake message (dictionary).
    If the key is not present, raise the diagnostic exception.
    """
    if keyname in grib_message:
        return type(grib_message[keyname])
    raise _mock_eccodes.CodesInternalError(keyname)