Change active area type?

OK, how do I change just the active area to a different type. I got this and it does what I want ,but it changes every area that is image editor to 3d view. I’ve searched and searched ,but can’t get anything to work.

            for area in bpy.context.screen.areas:
                if area.type == 'IMAGE_EDITOR':
                    area.type = 'VIEW_3D'

have you tried the editor type pies? the editor type code is in there to a degree.
maybe your looking for this?
https://github.com/meta-androcto/blenderpython279/tree/master/scripts/addons_extern/AF_areatype_switch-master