code: def monte_carlo_vol(self, ndraws=10000, rstate=None,
                          return_overlap=True):
          
  
          if rstate is None:
              rstate = np.random
  
          # Estimate volume using Monte Carlo integration.
          samples = [self.sample(rstate=rstate, return_q=True)
                     for i in range(ndraws)]
          qsum = sum([q for (x, idx, q) in samples])
          vol = 1. * ndraws / qsum * self.vol_tot
  
          if return_overlap:
              # Estimate the fractional amount of overlap with the
              # unit cube using the same set of samples.
              qin = sum([q * unitcheck(x) for (x, idx, q) in samples])
              overlap = 1. * qin / qsum
              return vol, overlap
          else:
              return vol
docs: Using `ndraws` Monte Carlo draws, estimate the volume of the
          *union* of ellipsoids. If `return_overlap=True`, also returns the
          estimated fractional overlap with the unit cube.