def _assert_executable_regions_match(workflow_enabled_regions, workflow_spec):
    """
    Check if the global workflow regions and the regions of stages (apps) match.
    If the workflow contains any applets, the workflow can be currently enabled
    in only one region - the region in which the applets are stored.
    """
    executables = [i.get("executable") for i in workflow_spec.get("stages")]

    for exect in executables:

        if exect.startswith("applet-") and len(workflow_enabled_regions) > 1:
            raise WorkflowBuilderException("Building a global workflow with applets in more than one region is not yet supported.")

        elif exect.startswith("app-"):
            app_regional_options = dxpy.api.app_describe(exect, input_params={"fields": {"regionalOptions": True}})
            app_regions = set(app_regional_options['regionalOptions'].keys())
            if not workflow_enabled_regions.issubset(app_regions):
                additional_workflow_regions = workflow_enabled_regions - app_regions
                mesg = "The app {} is enabled in regions {} while the global workflow in {}.".format(
                    exect, ", ".join(app_regions), ", ".join(workflow_enabled_regions))
                mesg += " The workflow will not be able to run in {}.".format(", ".join(additional_workflow_regions))
                mesg += " If you are a developer of the app, you can enable the app in {} to run the workflow in that region(s).".format(
                    ", ".join(additional_workflow_regions))
                logger.warn(mesg)

        elif exect.startswith("workflow-"):
             # We recurse to check the regions of the executables of the inner workflow
            inner_workflow_spec = dxpy.api.workflow_describe(exect)
            _assert_executable_regions_match(workflow_enabled_regions, inner_workflow_spec)

        elif exect.startswith("globalworkflow-"):
            raise WorkflowBuilderException("Building a global workflow with nested global workflows is not yet supported")