def pad_baskets(cust_list: list, max_items: int) -> list:
    """
    Function to pad all customer baskets to a standard length and remove any
    baskets that contain more than the maximum specified number of items

    Parameters
    ----------
    cust_list: list
        List of customers and items purchased in each transaction
    max_items: int
        Maximum number of items allowed for basket to be used in modeling

    Returns
    -------
    cust_list_pad: list
        List of customers and items purchased with padding to ensure baskets are
        a standard length

    """

    cust_list_pad = list()

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

        cust = cust_list[i]

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

            # Only keep the transaction if it has fewer than the maximum allowed number of items
            if len(bask) < max_items:
                # Pad the basket to a standard length
                pad = [0] * (max_items - len(bask))
                cust_prod_list_pad = bask + pad

                # Append to the customers list of transactions
                bask_list.append(cust_prod_list_pad)

        # append the current customer baskets to the cumulative list of all customers
        cust_list_pad.append(bask_list)

    return cust_list_pad