<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _mdot_r(a, b):
 """Recursive helper for mdot"""

    if type(a) == tuple:
        if len(a) > 1:
            a = mdot(*a)
        else:
            a = a[0]
    if type(b) == tuple:
        if len(b) > 1:
            b = mdot(*b)
        else:
            b = b[0]
    return np.dot(a, b)