def add(self, term):
        if isinstance(term, IndexMatrix):
            if term.shape[0] == 1:
                # Thank you, stack overflow
                # http://stackoverflow.com/questions/20060753/efficiently-subtract-vector-from-matrix-scipy
                mat = self.matrix.tocsc()
                t_mat = term.matrix
                mat.data += np.repeat(t_mat.toarray()[0], np.diff(mat.indptr))
                return self._new_instance(mat)
            elif term.shape[1] == 1:
                mat = self.matrix.copy()
                t_mat = term.matrix.T
                mat.data += np.repeat(t_mat.toarray()[0], np.diff(mat.indptr))
                return self._new_instance(mat)
            else:
                return self._new_instance(self.matrix + term.matrix)
        elif isinstance(term, Number):
            self.matrix.eliminate_zeros()
            mat = self.matrix.copy()
            mat.data = mat.data + term
            return self._new_instance(mat)
        else:
            raise NotImplementedError("The operation is currently not supported.")
Overrides the Flask-Security/Flask-Mail integration
dataset/ETHPy150Open jimmycallin/pydsm/pydsm/indexmatrix.py/IndexMatrix.add--crossover with--dataset/ETHPy150Open Netflix/security_monkey/security_monkey/__init__.py/send_email