code: def guard_submit(analysis_request):
      
      analyses_ready = False
      for analysis in analysis_request.getAnalyses():
          analysis = api.get_object(analysis)
          analysis_status = api.get_workflow_status_of(analysis)
          if analysis_status in ANALYSIS_DETACHED_STATES:
              continue
          if analysis_status in ['assigned', 'unassigned', 'registered']:
              return False
          analyses_ready = True
      return analyses_ready
docs: Return whether the transition "submit" can be performed or not.
      Returns True if there is at least one analysis in a non-detached state and
      all analyses in a non-detached analyses have been submitted.