def METHOD_NAME(self, matrix, key):
    value = matrix[key]
    # Reduce to a scalar if possible.
    if cvxpy.interface.matrix_utilities.shape(value) == (1, 1):
        return cvxpy.interface.matrix_utilities.scalar_value(value)
    else:
        return value