code: def get_severity(self, alert):
          
          query = {
              'environment': alert.environment,
              'resource': alert.resource,
              '$or': [
                  {
                      'event': alert.event,
                      'severity': {'$ne': alert.severity}
                  },
                  {
                      'event': {'$ne': alert.event},
                      'correlate': alert.event
                  }],
              'customer': alert.customer
          }
          r = self.get_db().alerts.find_one(query, projection={'severity': 1, '_id': 0})
          return r['severity'] if r else None
docs: Get severity of correlated alert. Used to determine previous severity.