code: def is_analysis_edition_allowed(self, analysis_brain):
          
          if not self.context_active:
              # The current context must be active. We cannot edit analyses from
              # inside a deactivated Analysis Request, for instance
              return False
  
          analysis_obj = api.get_object(analysis_brain)
          if analysis_obj.getPointOfCapture() == 'field':
              # This analysis must be captured on field, during sampling.
              if not self.has_permission(EditFieldResults, analysis_obj):
                  # Current user cannot edit field analyses.
                  return False
  
          elif not self.has_permission(EditResults, analysis_obj):
              # The Point of Capture is 'lab' and the current user cannot edit
              # lab analyses.
              return False
  
          # Check if the user is allowed to enter a value to to Result field
          if not self.has_permission(FieldEditAnalysisResult, analysis_obj):
              return False
  
          # Is the instrument out of date?
          # The user can assign a result to the analysis if it does not have any
          # instrument assigned or the instrument assigned is valid.
          if not self.is_analysis_instrument_valid(analysis_brain):
              # return if it is allowed to enter a manual result
              return analysis_obj.getManualEntryOfResults()
  
          return True
docs: Returns if the analysis passed in can be edited by the current user
  
          :param analysis_brain: Brain that represents an analysis
          :return: True if the user can edit the analysis, otherwise False