code: def setSampleTypes(self, value, **kw):
          
          bsc = getToolByName(self, 'bika_setup_catalog')
          # convert value to objects
          if value and type(value) == str:
              value = [bsc(UID=value)[0].getObject(), ]
          elif value and type(value) in (list, tuple) and type(value[0]) == str:
              value = [bsc(UID=uid)[0].getObject() for uid in value if uid]
          if not type(value) in (list, tuple):
              value = [value, ]
          # Find all SampleTypes that were removed
          existing = self.Schema()['SampleTypes'].get(self)
          removed = existing and [s for s in existing if s not in value] or []
          added = value and [s for s in value if s not in existing] or []
          ret = self.Schema()['SampleTypes'].set(self, value)
  
          # finally be sure that we aren't trying to set None values here.
          removed = [x for x in removed if x]
          added = [x for x in added if x]
  
          for st in removed:
              samplepoints = st.getSamplePoints()
              if self in samplepoints:
                  samplepoints.remove(self)
                  st.setSamplePoints(samplepoints)
  
          for st in added:
              st.setSamplePoints(list(st.getSamplePoints()) + [self, ])
  
          return ret
docs: For the moment, we're manually trimming the sampletype<>samplepoint
              relation to be equal on both sides, here.
              It's done strangely, because it may be required to behave strangely.