code: def sumprod(seq):
      
      if isinstance(seq, tuple):
          # important to make sure dtype is int
          # since prod on empty tuple is a float (1.0)
          return np.prod(seq, dtype=int)
      else:
          return np.sum((sumprod(s) for s in seq), dtype=int)
docs: Product of tuple, or sum of products of lists of tuples.
  
      Parameters
      ----------
      seq : tuple or list
  
      Returns
      -------
      int :
          the product of input tuples, or the sum of products of lists of tuples,
          recursively.
  
      Examples
      --------
      >>> tup = (1, 2, 3)
      >>> sumprod(tup)
      6
  
      >>> lis = [(1, 2, 3), (2, 2)]
      >>> sumprod(lis)
      10
  
      >>> lis = [(1, 2, 3), [(2, 1), (3,)]]
      >>> sumprod(lis)
      11