To rename a new group you can after creating first get out of the group
# Get out of group
bpy.ops.node.group_edit( get_override('NODE_EDITOR') )
Then name the active node which is the group
groupname = bpy.context.active_object.active_material.node_tree.nodes.active
Then if needed get "back in the group"
bpy.ops.node.group_edit( get_override('NODE_EDITOR') )
The override function:
def get_override(area_type):
for window in bpy.context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == area_type:
for region in area.regions:
if region.type == 'WINDOW':
override = {'window': window,
'screen': screen,
'area': area,
'region': region,
'blend_data': bpy.context.blend_data}
return override