/**
 * Given a dictionary and a key, get the corresponding value using the 'in' operator and handle any errors that may occur.
 *
 * @param dictionary The dictionary to be accessed.
 * @param key The key to be searched in the dictionary.
 * @return The value associated with the key if it exists in the dictionary, otherwise returns null.
 */
fun getValueFromDict(dictionary: Map<String, Any>, key: String): Any? {

    try {
        // Check if the key exists in the dictionary
        if (key in dictionary) {
            val value = dictionary[key]
            return value
        } else {
            return null
        }
    } catch (e: ClassCastException) {
        // Handle ClassCastException when the dictionary is not of type 'Map<String, Any>'
        println("Invalid input: 'dictionary' should be of type 'Map<String, Any>'")
    } catch (e: Exception) {
        // Handle any other unknown errors
        println("An error occurred while accessing the dictionary")
    }
    return null
}
/**
 * Given a dictionary and a key, get the corresponding value using the 'in' operator and handle any errors that may occur.
 *
 * @param dictionary The dictionary to be accessed.
 * @param key The key to be searched in the dictionary.
 * @return The value associated with the key if it exists in the dictionary, otherwise returns null.
 */
fun getValueFromDict(dictionary: Map<String, Any>, key: String): Any? {
/**
 * Given a dictionary and a key, get the corresponding value using the 'in' operator and handle any errors that may occur.
 *
 * @param dictionary The dictionary to be accessed.
 * @param key The key to be searched in the dictionary.
 * @return The value associated with the key if it exists in the dictionary, otherwise returns null.
 */
fun getValueFromDict(dictionary: Map<String, Any>, key: String): Any? {

    try {
        // Check if the key exists in the dictionary
        if (key in dictionary) {
            val value = dictionary[key]
            return value
        } else {
            return null
        }
    } catch (e: ClassCastException) {
        // Handle ClassCastException when the dictionary is not of type 'Map<String, Any>'
        println("Invalid input: 'dictionary' should be of type 'Map<String, Any>'")
    } catch (e: Exception) {
        // Handle any other unknown errors
        println("An error occurred while accessing the dictionary")
    }
    return null
}