import _typing


def sort_lists_by_list(lists: _typing.List[_typing.List],
                       key_list_index: int = 0,
                       desc: bool = False) -> _typing.Iterator[_typing.Tuple]:
    """Sort multiple lists by one list.

    The key_list gets sorted. The other lists get sorted in the same order.

    Reference: https://stackoverflow.com/a/15611016/8116031

    :param lists: list of lists to be sorted
    :param key_list_index: index of list in lists to sort by
    :param desc: False: ascending order
    :return: sorted lists
    """
    # note: two-liner equivalent:
    # line1: convert (zip(a,b,c,...)) lists into list of tuples, and
    #        sort elements of this list by key_list elements, i.e. key_list-th
    #        element in each tuple.
    # line2: unpack tuple list back into orignal, sorted, lists using
    #        nested list comprehensions and tuple unpacking.
    # sorted_lists = sorted(zip(*lists), reverse=desc, key=lambda x: x[key_list])
    # return [[x[i] for x in sorted_lists] for i in range(len(lists))]

    return zip(*sorted(zip(*lists), reverse=desc, key=lambda x: x[key_list_index]))