code: def distance(self, method='haversine'):
          
          distances = []
          for segment in self:
              if len(segment) < 2:
                  distances.append([])
              else:
                  distances.append(segment.distance(method))
          return distances
docs: Calculate distances between locations in segments.
  
          Args:
              method (str): Method used to calculate distance
  
          Returns:
              list of list of float: Groups of distance between points in
                  segments