def convert_prod_to_index(cust_list: list, prod_dict: dict) -> list:
    """
    Function to convert lists of customers/baskets/products to customer/baskets/product indices
    as required by the downstream sequence models

    Parameters
    ----------
    cust_list: list
      List of customers and PROD_CODE for items purchased in each transaction
    prod_dict: dict
        Dictionary mapping of PROD_CODE to index

    Returns
    -------
    cust_list_index: list
      List of customers and the index for items purchased

    """

    cust_index = list()

    # Customer loop
    for i in range(0, len(cust_list)):

        cust = cust_list[i]

        # Basket loop
        bask_list = list()
        for bask in cust:
            # Product loop
            prod_list = list()
            for prod in bask:

                if prod in prod_dict:
                    item_integer = prod_dict[prod]
                else:
                    item_integer = 0  # dictionary['UNK']
                prod_list.append(item_integer)
            bask_list.append(prod_list)
        cust_index.append(bask_list)

    return cust_index