def key_exists_in_list_or_dict(key, lst_or_dct):
    """True if `lst_or_dct[key]` does not raise an Exception"""
    if isinstance(lst_or_dct, dict) and key in lst_or_dct:
        return True
    elif isinstance(lst_or_dct, list):
        min_i, max_i = 0, len(lst_or_dct)
        if min_i <= key < max_i:
            return True
    return False
True if `lst_or_dct[key]` does not raise an Exception