def GetApplication():
    '''Return app environment as: ARCMAP, ARCGIS_PRO, OTHER'''

    global app_found
    if app_found != 'NOT_SET':
            return app_found

    try:
        from arcpy import mp
    except __HOLE__:
        try:
            from arcpy import mapping
            mxd = arcpy.mapping.MapDocument("CURRENT")
            app_found = "ARCMAP"
            return app_found
        except:
            app_found = "OTHER"
            return app_found
    try:
        aprx = arcpy.mp.ArcGISProject('CURRENT')
        app_found = "ARCGIS_PRO"
        return app_found
    except:
        app_found = "OTHER"
        return app_found
dataset/ETHPy150Open Esri/solutions-geoprocessing-toolbox/operational_graphics/toolboxes/scripts/Utilities.py/GetApplication