def split_batch(games, batch_size, use_padding):
    """
    Split a list of games into sublist of games of size batch_size

    :param games: list of games that is going to be used to create a batch
    :param batch_size: number of games used by batch
    :param use_padding: pad with already used games to fill the last batch
    :return: a list of list of games
    """
    i = 0
    is_done = False

    batch = []

    while not is_done:
        end = min(i + batch_size, len(games))
        selected_games = games[i:end]
        i += batch_size

        if i >= len(games):
            is_done = True
            if use_padding:
                no_missing = batch_size - len(selected_games)
                selected_games += games[:no_missing]

        batch.append(selected_games)

    return batch