code: def isVisible(self, instance, mode='view', default="visible", field=None):
      
      # Emulate Products.Archetypes.Widget.TypesWidget#isVisible first
      vis_dic = getattr(aq_base(self), 'visible', _marker)
      state = default
      if vis_dic is _marker:
          return state
      if type(vis_dic) is DictType:
          state = vis_dic.get(mode, state)
      elif not vis_dic:
          state = 'invisible'
      elif vis_dic < 0:
          state = 'hidden'
  
      # Our custom code starts here
      if not field:
          return state
  
      # Look for visibility from the adapters provided by IATWidgetVisibility
      adapters = sorted(getAdapters([instance], IATWidgetVisibility),
                        key=lambda adapter: getattr(adapter[1], "sort", 1000),
                        reverse=True)
      for adapter_name, adapter in adapters:
          if field.getName() not in getattr(adapter, "field_names", []):
              # Omit those adapters that are not suitable for this field
              continue
          adapter_state = adapter(instance, mode, field, state)
          adapter_name = adapter.__class__.__name__
          logger.info("IATWidgetVisibility rule {} for {}.{} ({}): {} -> {}"
              .format(adapter_name, instance.id, field.getName(), mode, state,
                      adapter_state))
          if adapter_state == state:
              continue
          return adapter_state
  
      return state
docs: decide if a field is visible in a given mode -> 'state'.