def binary_search(list_to_search_in, key_to_search_for, field = lambda item: item["title"]):
    """
        Does a binary search through a list containing dictionaries.
        Defaults to searching for "title" if no other filed is specified.
    """

    if len(list_to_search_in) == 0:
        return "Error"

    #to make the search work with lowercase and uppercase - make everything to lowercase.
    field_to_use = lambda l: field(l).lower()

    key_to_search_for = key_to_search_for.lower()
    #sort the list, because binary only works on sorted lists.
    list_to_search_in = sorted(list_to_search_in, key = field_to_use)

    #init low, high.
    low = 0
    high = len(list_to_search_in) - 1

    #while we have not found the item yet
    while low <= high:
        #get middle of list
        mid = (low + high) // 2
        #if search key is at a lower index than mid
        if field_to_use(list_to_search_in[mid]) > key_to_search_for:
            high = mid - 1
        #if search key is at a higher index than mid
        elif field_to_use(list_to_search_in[mid]) < key_to_search_for:
            low = mid + 1
            #item is found
        else:
            return list_to_search_in[mid]

    #if nothing was found in list.
    return "No such item in list."