<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def confusion_to_mcc(*args):
 """Convert the confusion matrix to the Matthews correlation coefficient Parameters: cm : ndarray 2x2 confusion matrix with np.array([[tn, fp], [fn, tp]]) tn, fp, fn, tp : float four scalar variables - tn : number of true negatives - fp : number of false positives - fn : number of false negatives - tp : number of true positives Return: ------- r : float Matthews correlation coefficient """

    if len(args) is 1:
        tn, fp, fn, tp = args[0].ravel().astype(float)
    elif len(args) is 4:
        tn, fp, fn, tp = [float(a) for a in args]
    else:
        raise Exception((
            "Input argument is not an 2x2 matrix, "
            "nor 4 elements tn, fp, fn, tp."))

    return (tp * tn - fp * fn) / np.sqrt(
        (tp + fp) * (tp + fn) * (tn + fp) * (tn + fn))