def create_window_array(window, season_lag=None):
    """
    Create a sliding window array (i.e. a array of True and False values that
    is used to determine what past values should be used to to forecast the
    next value).

    Args:
        window: An integer that is converted into its binary representation
        which corresponds to the sliding window. For example, a input of 9
        would correspond to a window of [1, 0, 0, 1].
        season_lag: If value is present three values surrounding the lag are
        included into the sliding window. For example, a a window of 1 (i.e.
        only the last value) and a season lag of 5 leads to a window
        [1, 0, 0, 1, 1, 1].

    Returns:
       The sliding window array.
    """
    window = [int(digit) for digit in bin(window)[2:]]
    if season_lag:
        window += [0] * (season_lag - len(window) - 2) + [1, 1, 1]
    return window