def getMaxLevel(form):
    """
    Calculates the max depth of the paranthesis.

    Parameters
    ----------
    form : string
        Formula.

    Returns
    -------
    maxlevel : int
        The max depth of the paranthesis.
    """
    level = 0
    maxlevel = 0
    for ch in form:
        if(ch == '('):
            level += 1
            if(level > maxlevel):
                maxlevel = level
        elif(ch == ')'):
            level -= 1
    return maxlevel