'Creates a Group Configuration containing a list of groups.
Optionally creates a Content Experiment and associates it with previous Group Configuration.
Returns group configuration or (group configuration, experiment xblock)'

def create_group_configuration_experiment(self, groups, associate_experiment):

    self.course_fixture._update_xblock(self.course_fixture._course_location, {'metadata': {u'user_partitions': [create_user_partition_json(0, 'Name', 'Description.', groups)]}})
    if associate_experiment:
        vertical = self.course_fixture.get_nested_xblocks(category='vertical')[0]
        split_test = XBlockFixtureDesc('split_test', 'Test    Content    Experiment', metadata={'user_partition_id': 0})
        self.course_fixture.create_xblock(vertical.locator, split_test)
    self.page.visit()
    config = self.page.experiment_group_configurations[0]
    if associate_experiment:
        return (config, split_test)
    return config
