code: def section_tortuosity(section):
      '''Tortuosity of a section
  
      The tortuosity is defined as the ratio of the path length of a section
      and the euclidian distnce between its end points.
  
      The path length is the sum of distances between consecutive points.
  
      If the section contains less than 2 points, the value 1 is returned.
      '''
      pts = section.points
      return 1 if len(pts) < 2 else mm.section_length(pts) / mm.point_dist(pts[-1], pts[0]f section_tortuosity(section):
      '''Tortuosity of a section
  
      The tortuosity is defined as the ratio of the path length of a section
      and the euclidian distnce between its end points.
  
      The path length is the sum of distances between consecutive points.
  
      If the section contains less than 2 points, the value 1 is returned.
      '''
      pts = section.points
      return 1 if len(pts) < 2 else mm.section_length(pts) / mm.point_dist(pts[-1], pts[0])
docs: Tortuosity of a section
  
      The tortuosity is defined as the ratio of the path length of a section
      and the euclidian distnce between its end points.
  
      The path length is the sum of distances between consecutive points.
  
      If the section contains less than 2 points, the value 1 is returned.