Python Join Same Name function I'm getting this error and am not quite sure how to fix it



Please see below for my code....

def execute(self, context):
    for obj in bpy.context.selected_objects:
        charlen = 15
        namestore_1 = obj.name[:charlen]
        bpy.context.scene.objects.active = obj
        for ob in bpy.context.scene.objects:
            namestore_2 = ob.name[:charlen]
            if ob.type == 'MESH':
                if str(namestore_1) == (namestore_2):
                    ob.select = True
                else:
                    ob.select = False
    for selected in bpy.context.selected_objects:
        if selected.type == 'MESH':
            bpy.ops.object.join()


Thanks in advance for any help :) this ones been bugging me for a while!

[edit - updated code slightly for variable in place of number where the character lenght is involved]
An operator's execute(), invoke() or modal() methods must return a status as a set(). Also note that the return result must be one of {'RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', ‘INTERFACE’}

The shortcut to creating a set is to wrap the item in curly braces {}.

def execute(self, context):
    # do stuff
    return {'FINISHED'}