def get_sort(ls: list, k: int = 0):
    ls.sort()
    return ls[k]


def combineList(ls: list, lsN: list) -> list:
    for k in range(len(lsN)):
        ls.append(lsN[k])
    return ls


def find_original_case(input_list, search_string):
    for obj in input_list:
        if obj.lower() == search_string.lower():
            return obj
    return None


def ensure_nested_list(obj):
    if not isinstance(obj, list):
        return [obj]
    for element in obj:
        if not isinstance(element, list):
            return [obj]
    return obj


def make_list_add(obj, values):
    obj = list(obj)
    for each in list(values):
        obj.append(each)
    return obj


def recursive_json_list(json_list: dict, desired_values: dict) -> list:
    recursed_list = []
    for json_obj in json_list:
        bool_count = 0
        for desired_key, desired_value in desired_values.items():
            if desired_key in json_obj:
                if json_obj[desired_key] == desired_value:
                    bool_count += 1
        if bool_count == len(list(desired_values.keys())):
            recursed_list.append(json_obj)
    return recursed_list


def filter_json_list_values(json_list: list, keys: list):
    all_keys = {}
    for key in keys:
        unique_values = []
        for json_obj in json_list:
            if key in json_obj:
                if json_obj[key] not in unique_values:
                    unique_values.append(json_obj[key])
        all_keys[key] = unique_values
    return all_keys


def get_highest_value_obj(obj_list, function):
    return max(obj_list, key=function)


def safe_list_return(current_list, list_num=0):
    if len(current_list) >= list_num + 1:
        return current_list[int(list_num)]


def get_actual_number(reference_object, number_value):
    try:
        reference_length = len(reference_object)
    except Exception:
        reference_length = 0
    if reference_length == 0:
        return None
    return max(0, min(number_value, reference_length - 1))


def compare_lists(list_1, list_2):
    if len(list_1) > len(list_2):
        return False
    for each in list_1:
        if each not in list_2:
            return False
    return True


def remove_from_list(list_obj, key, value):
    return [obj for obj in list_obj if not (isinstance(obj, dict) and obj.get(key) == value)]


def list_set(obj):
    try:
        obj = list(set(obj))
    except Exception as e:
        print(f"{e}")
    return obj


def get_symetric_difference(obj_1, obj_2):
    set1 = set(obj_1)
    set2 = set(obj_2)
    return list(set1.symmetric_difference(set2))


def make_list_it(obj=None):
    return make_list(obj or [])


def get_single_from_list(list_obj, default=None):
    return make_list(list_obj or default)[0]
