def keys_with_substring(dictionary, target, sensitivity = False): """ Returns a list of keys from a dictionary that contain a target string, performing a case-insensitive comparison when sensitivity is False. Args: dictionary (dict): The dictionary to search within. target (str): The string to search for within the dictionary keys. sensitivity (bool): whether the checking is done in a case senstive way of a case insensitive way. Returns: list: A list of keys from the dictionary that contain the target string. """ if sensitivity: return list(filter(lambda key: target in key, dictionary.keys())) else: return list(filter(lambda key: target.lower() in key.lower(), dictionary.keys()))