def validate_environment():
    """Make sure we have a version of the product that works, and that
    the library isn't already loaded."""

    (install_dir, arc_version, product) = arcgis_platform()
    # earlier versions excluded by virtue of not having Python toolbox support
    no_hook_versions = ('10.1', '10.2', '10.2.1', '10.2.2', '10.3')
    if arc_version in no_hook_versions and product is not 'Pro':
        arcpy.AddError("The ArcGIS R bridge requires ArcGIS 10.3.1 or later.")
        sys.exit()

    if arc_version in ('1.0', '1.0.2') and product == 'Pro':
        arcpy.AddError("The ArcGIS R bridge requires ArcGIS Pro 1.1 or later.")
        sys.exit()

    # check the library isn't loaded
    if bridge_running(product):
        msg = "The ArcGIS R bridge is currently in-use, restart the " + \
              "application and try again."
        arcpy.AddError(msg)
        sys.exit()
dataset/ETHPy150Open R-ArcGIS/r-bridge-install/rtools/install_package.py/validate_environment/original