import itertools


def create_weekend_base(n_weeks):
    """
    Generate basis for cartesion product of [0,1] lists based
    on number of weeks in scheduling problem. Each list
    element is one week. The tuple of binary values represent the
    first and second day of the weekend for that week. A 1 means
    the day is worked, a 0 means it is off.

    Input:
        n_weeks - number of weeks in scheduling horizon

    Output:
        Result is all the possible n_weeks weekends worked patterns.
        Example: n_weeks = 4 --> 256 possible weekends worked patterns. This
        exhaustive list can later be filtered to only include desirable patterns.

    """


    basis_list = [[0,0],[1,0],[0,1],[1,1]]

    mw_basis_list = []
    for i in range(n_weeks):
        mw_basis_list.append(basis_list)

    # Use itertools to create the n_weeks cartesion product of the basis_list.

    return list(itertools.product(*mw_basis_list))