def METHOD_NAME(arg):
    # get armature and its bones
    obs = [ob for ob in self.context.selected_objects if ob.type == 'ARMATURE']
    if obs:
        boneitems = [(bonename, bone)
                     for (bonename, bone) in list(obs[0].getPose().bones.items())]
    else:
        boneitems = []
    # exit if no bones selected
    if not boneitems:
        print("no armature selected")
        Blender.Draw.PupMenu('ERROR%t|no armature selected')
        return
    # ask for weights to delete
    PREF_BUFFER = Blender.Draw.Create("BonePose")
    pup_block = [\
    ('Text Buffer: ', PREF_BUFFER, 0, 20, 'The text buffer to load the bone poses from.'),\
    ]
    if not Blender.Draw.PupBlock('Load Bone Pose', pup_block):
        return
    # saves editmode state and exit editmode if it is enabled
    # (cannot make changes mesh data in editmode)
    is_editmode = Window.EditMode()
    Window.EditMode(0)    
    Window.WaitCursor(1)
    t = sys.time()
    # run script
    # open text buffer
    try:
        posetxt = Blender.Text.Get(PREF_BUFFER.val)
    except NameError:
        Blender.Draw.PupMenu('ERROR%t|text buffer does not exist')
        return
    # reconstruct poses
    for matrixtxt in posetxt.asLines():
        # skip empty lines
        if not matrixtxt:
            continue
        # reconstruct matrix from text
        bonename, matrixstr = matrixtxt.split('/')
        print(f"loading pose of bone {bonename:s} from {PREF_BUFFER.val:s}")
        try:
            matrix = mathutils.Matrix(
                *[[float(f) for f in row.split(',')]
                  for row in matrixstr.split(';')])
        except:
            Blender.Draw.PupMenu('ERROR%t|syntax error in buffer')
            return
        # save pose matrix
        for bonename2, bone in boneitems:
            if bonenamematch(bonename, bonename2):
                bone.quat = matrix.rotationPart().toQuat()
                bone.loc = matrix.translationPart()
                break
        else:
            print(f"WARNING: bone {bonename:s} not found in armature")
    # display the result
    obs[0].getPose().update()
    # report finish and timing
    print(f'Load bone pose finished in {(sys.time()-t):.2f} seconds')
    Window.WaitCursor(0)
    if is_editmode:
        Window.EditMode(1)