code: def dist(self, x1, x2):
          
          dnorms = np.fromiter(
              ((x1i - x2i).norm() for x1i, x2i in zip(x1, x2)),
              dtype=np.float64, count=len(x1))
  
          if self.exponent == float('inf'):
              return self.const * np.linalg.norm(dnorms, ord=self.exponent)
          else:
              return (self.const ** (1 / self.exponent) *
                      np.linalg.norm(dnorms, ord=self.exponent))
docs: Calculate the constant-weighted distance between two elements.
  
          Parameters
          ----------
          x1, x2 : `ProductSpaceElement`
              Elements whose mutual distance is calculated.
  
          Returns
          -------
          dist : float
              The distance between the elements.