How to give user the possibility of extending an addon with python

In an add-on I’m building I have a structure like the following (omitting most of the detail for simplicity)

class Armature_handler:
    ...
    def put_quad_on_bone( self, quat ):
        #before the actual work
        do_it( self.the_bone, quat)
        #after the actual work

Now, I would like to give the user to possibility of eventually modify the way this works with a custom python script, in particular I would like him to be able to define two functions, for example

def modify_quat_before(quat):
    #modify quat

def use_bone_data_after(bone):
    #use bone

that would be used like

class Armature_handler:
    ...
    def put_quad_on_bone( self, quat ):
        modify_quat_before(quat)
        do_it( self.the_bone, quat)
        use_bone_data_after( self.the_bone)

I would like the user to be able to write everything directly on the internal editor, and then reference the textblock from the GUI.
My doubt is: shall I parse the text and then exec it, or there’s another solution?

I guess exec ist the way to go here.

Functions are first class objects in python. You can assign them to variables and pass them as parameters.