code: def guard_submit(analysis):
      
      # Cannot submit without a result
      if not analysis.getResult():
          return False
  
      # Cannot submit with interims without value
      for interim in analysis.getInterimFields():
          if not interim.get("value", ""):
              return False
  
      # Cannot submit if attachment not set, but is required
      if not analysis.getAttachment():
          if analysis.getAttachmentOption() == 'r':
              return False
  
      # Check if can submit based on the Analysis Request state
      if IRequestAnalysis.providedBy(analysis):
          point_of_capture = analysis.getPointOfCapture()
          # Cannot submit if the Sample has not been received
          if point_of_capture == "lab" and not analysis.isSampleReceived():
              return False
          # Cannot submit if the Sample has not been sampled
          if point_of_capture == "field" and not analysis.isSampleSampled():
              return False
  
      # Check if the current user can submit if is not assigned
      if not analysis.bika_setup.getAllowToSubmitNotAssigned():
          if not user_has_super_roles():
              # Cannot submit if unassigned
              if not analysis.getAnalyst():
                  return False
              # Cannot submit if assigned analyst is not the current user
              if analysis.getAnalyst() != api.get_current_user().getId():
                  return False
  
      # Cannot submit unless all dependencies are submitted or can be submitted
      for dependency in analysis.getDependencies():
          if not is_submitted_or_submittable(dependency):
              return False
      return True
docs: Return whether the transition "submit" can be performed or not