code: def guard_sample(analysis_request):
      
      if analysis_request.getDateSampled() and analysis_request.getSampler():
          return True
  
      current_user = api.get_current_user()
      return "Sampler" in current_user.getRolesInContext(analysis_request)
docs: Returns whether 'sample' transition can be performed or not. Returns
      True only if the analysis request has the DateSampled and Sampler set or if
      the user belongs to the Samplers group