code: def _mdot_r(a, b):
      
      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)
docs: Recursive helper for mdot