code: def isVisible(self, field, mode="view", default="visible"):
          
          if mode != "edit":
              return default
  
          # If this is a Secondary Analysis Request, this field is not editable
          if IAnalysisRequestSecondary.providedBy(self.context):
              return "invisible"
  
          return self.context.isOpen() and "visible" or "invisible"
docs: Returns whether the field is visible in a given mode