code: def _should_send(self, rebuild, success, auto_canceled, manual_canceled):
          
          should_send = False
  
          should_send_mapping = {
              self.MANUAL_SUCCESS: not rebuild and success,
              self.MANUAL_FAIL: not rebuild and not success,
              self.MANUAL_CANCELED: not rebuild and manual_canceled,
              self.AUTO_SUCCESS: rebuild and success,
              self.AUTO_FAIL: rebuild and not success,
              self.AUTO_CANCELED: rebuild and auto_canceled
          }
  
          for state in self.send_on:
              should_send |= should_send_mapping[state]
          return should_send
docs: Return True if any state in `self.send_on` meets given conditions, thus meaning
          that a notification mail should be sent.