How to select objects and join them with Python
Here's the pseudo code:

make sure nothing is selected to start off.

for every empty that has children:
    1. select all children of the empty
    2. set first child to active_object (or any child)
    3. invoke a bpy.ops.join
    4. deselect everything


Because you can't join anything to an Empty, You have to programmatically set a Mesh Object to be the Active Object then join other selected mesh objects to it.

Here's the python:

import bpy

# get the list of empties that have children
empties = [e for e in bpy.data.objects if e.type == 'EMPTY' and e.children]

# we need to deselect everything first
bpy.ops.object.select_all(action='DESELECT')

for empty in empties:
    for obj in empty.children:
        obj.select = True
    joiner = empty.children[0]
    bpy.context.scene.objects.active = joiner
    bpy.ops.object.join()

    # deselect everything before the next iteration
    bpy.ops.object.select_all(action='DESELECT')