def get_possible_groupings(number_list, target_sum):
    """
    Given a number of beats in a bar, this method generates a list of all possible groupings
    of the numbers 2, 3, and 4 that sum to the number of beats in a a bar.
    
    :param number_list: list of integers. The groups of beats that are allowed.
    :param target_sum: integer. number of beats in a bar
    
    :return matching_numbers: list of groupings. eg. [[2, 2, 3], [2, 3, 2], [3, 2, 2] ... ]
    """
    matching_numbers = []

    def recursion(subset):
        for number in number_list:
            if sum(subset+[number]) < target_sum:
                recursion(subset+[number])
            elif sum(subset+[number]) == target_sum:
                matching_numbers.append(subset+[number])

    recursion([])
    return matching_numbers