code: def polyline2pathd(polyline_d, is_polygon=False):
      
      points = COORD_PAIR_TMPLT.findall(polyline_d)
      closed = (float(points[0][0]) == float(points[-1][0]) and
                float(points[0][1]) == float(points[-1][1]))
  
      # The `parse_path` call ignores redundant 'z' (closure) commands
      # e.g. `parse_path('M0 0L100 100Z') == parse_path('M0 0L100 100L0 0Z')`
      # This check ensures that an n-point polygon is converted to an n-Line path.
      if is_polygon and closed:
          points.append(points[0])
  
      d = 'M' + 'L'.join('{0} {1}'.format(x,y) for x,y in points)
      if is_polygon or closed:
          d += 'z'
      return d
docs: converts the string from a polyline points-attribute to a string for a
      Path object d-attribute