def split(windows, num):
    """Split an iterable of windows into `num` sublists of (roughly) equal
    length. Return a list of these sublists."""
    if num == 1:
        return [windows]
    windows = windows if isinstance(windows, list) else list(windows)
    length = len(windows) // num
    return [windows[i*length:(i+1)*length] for i in range(num)]