code: def _offbids_to_points(self, offbids, arebids=False):
          
          # Sort offers/bids by price in ascending order.
          offbids.sort(key=lambda x: x.price, reverse=arebids)
  
          points = [(0.0, offbids[0].noLoadCost)]
          # Form piece-wise linear total cost function.
          for i, offbid in enumerate(offbids):
              x1, y1 = points[i]
              x2 = x1 + offbid.quantity # MW.
              m = offbid.price # $/MWh
              y2 = m * (x2 - x1) + y1
              points.append((x2, y2))
  
          if arebids:
              points = [(-x, -y) for x, y in points]
              points.reverse()
  
  #        n_segs = len(points) - 1
  #        logger.info("%d segment pwl cost function: %s" % (n_segs, points))
  
          return points
docs: Returns a list of points for a piece-wise linear function from the
          given offer/bid blocks.