Import several groups in one step I try to append several groups from a .blend.

At the moment, i use this code:

with bpy.data.libraries.load(my_blend) as (data_from, data_to):
    if data_from.groups:
        for group in data_from.groups:
            directory = join(my_blend,"Group")
            bpy.ops.wm.append(filename=group, directory=directory)


This code works great but he append the groups one after the other and i need to append them in one steps to keep the groups in groups.

Is somebody would have an idea please ?
I finally found a solution in the documentation:

scn = bpy.context.scene

with bpy.data.libraries.load(blendfile) as (data_from, data_to):
    for attr in dir(data_to):
        setattr(data_to, attr, getattr(data_from, attr))

for obj in data_to.objects:
    if obj is not None:
        scn.objects.link(obj)


EDIT.

I edit my post to add a complement to my answer:

To import only chosen object and group, i finally write this code:

with bpy.data.libraries.load(blendfile) as (data_from, data_to):
    data_to.objects = [obj for obj in data_from.objects if obj in list_obj]
    data_to.groups = [gp for gp in data_from.groups if gp in list_gp]

    for obj in data_to.objects:
        if obj is not None:
            scn.objects.link(obj)