def get_dual(self, constraint, ymat=None):
if not isinstance(constraint, Expr):<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>elif self.status == "<STR_LIT>" and ymat is None:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>elif ymat is None:<EOL><INDENT>ymat = self.y_mat<EOL><DEDENT>index = self._constraint_to_block_index.get(constraint)<EOL>if index is None:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if len(index) == <NUM_LIT:2>:<EOL><INDENT>return ymat[index[<NUM_LIT:0>]], self.y_mat[index[<NUM_LIT:1>]]<EOL><DEDENT>else:<EOL><INDENT>return ymat[index[<NUM_LIT:0>]]<EOL><DEDENT>
Given a solution of the dual problem and a constraint of any type,
        it returns the corresponding block in the dual solution. If it is an
        equality constraint that was converted to a pair of inequalities, it
        returns a two-tuple of the matching dual blocks.

        :param constraint: The constraint.
        :type index: `sympy.core.exp.Expr`
        :param y_mat: Optional parameter providing the dual solution of the
                      SDP. If not provided, the solution is extracted
                      from the sdpRelaxation object.
        :type y_mat: :class:`numpy.array`.
        :returns: The corresponding block in the dual solution.
        :rtype: :class:`numpy.array` or a tuple thereof.