code: def guard_submit(obj):
      
      analyses = obj.getAnalyses()
      if not analyses:
          # An empty worksheet cannot be submitted
          return False
  
      can_submit = False
      for analysis in obj.getAnalyses():
          # Dismiss analyses that are not active
          if not api.is_active(analysis):
              continue
          # Dismiss analyses that have been rejected or retracted
          if api.get_workflow_status_of(analysis) in ["rejected", "retracted"]:
              continue
          # Worksheet cannot be submitted if there is one analysis not submitted
          can_submit = ISubmitted.providedBy(analysis)
          if not can_submit:
              # No need to look further
              return False
  
      # This prevents the submission of the worksheet if all its analyses are in
      # a detached status (rejected, retracted or cancelled)
      return can_submit
docs: Returns if 'submit' transition can be applied to the worksheet passed in.
      By default, the target state for the 'submit' transition for a worksheet is
      'to_be_verified', so this guard returns true if all the analyses assigned
      to the worksheet have already been submitted. Those analyses that are in a
      non-valid state (cancelled, inactive) are dismissed in the evaluation, but
      at least one analysis must be in an active state (and submitted) for this
      guard to return True. Otherwise, always returns False.
      Note this guard depends entirely on the current status of the children.