code: def updateSynapses(self, segment, synapses, delta):
      
  
      reached0 = False
  
      if delta > 0:
        for synapse in synapses:
          segment[synapse][2] = newValue = segment[synapse][2] + delta
  
          # Cap synapse permanence at permanenceMax
          if newValue > self.permanenceMax:
            segment[synapse][2] = self.permanenceMax
  
      else:
        for synapse in synapses:
          segment[synapse][2] = newValue = segment[synapse][2] + delta
  
          # Cap min synapse permanence to 0 in case there is no global decay
          if newValue < 0:
            segment[synapse][2] = 0
            reached0 = True
  
      return reached0
docs: Update a set of synapses of the given segment,
        delta can be permanenceInc, or permanenceDec.
  
      retval:   True if synapse reached 0