code: def _build_or_update_workflow(json_spec, args):
      
      try:
          if args.mode == 'workflow':
              json_spec = _get_validated_json(json_spec, args)
              workflow_id = _build_regular_workflow(json_spec)
          elif args.mode == 'globalworkflow':
              # Verify if the global workflow already exists and if the user has developer rights to it
              # If the global workflow name doesn't exist, the user is free to build it
              # If the name does exist two things can be done:
              # * either update the requested version, if this version already exists
              # * or create the version if it doesn't exist
              existing_workflow = dxpy.executable_builder.verify_developer_rights('globalworkflow-' + json_spec['name'])
              if existing_workflow and _version_exists(json_spec,
                                                       existing_workflow.name,
                                                       existing_workflow.version):
                  workflow_id = _update_global_workflow(json_spec, args, existing_workflow.id)
              else:
                  json_spec = _get_validated_json(json_spec, args)
                  workflow_id = _build_global_workflow(json_spec, args)
          else:
              raise WorkflowBuilderException("Unrecognized workflow type: {}".format(args.mode))
      except dxpy.exceptions.DXAPIError as e:
          raise e
      return workflow_id
docs: Creates or updates a workflow on the platform.
      Returns the workflow ID, or None if the workflow cannot be created.