code: def monte_carlo_vol(self, ctrs, ndraws=10000, rstate=None,
                          return_overlap=False, kdtree=None):
          
  
          if rstate is None:
              rstate = np.random
  
          # Estimate the volume using Monte Carlo integration.
          samples = [self.sample(ctrs, rstate=rstate, return_q=True,
                                 kdtree=kdtree)
                     for i in range(ndraws)]
          qsum = sum([q for (x, q) in samples])
          vol = 1. * ndraws / qsum * len(ctrs) * self.vol_cube
  
          if return_overlap:
              # Estimate the fractional overlap with the unit cube using
              # the same set of samples.
              qin = sum([q * unitcheck(x) for (x, 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 cubes. If `return_overlap=True`, also returns the
          estimated fractional overlap with the unit cube. Uses a K-D Tree
          to perform the search if provided.