def render(self, cr, where, max_w, max_h, highlights=None):
        cr.save()
        cr.set_line_width(0.1)

        # Set a clip to ensure we occupy at most max_w and max_h
        cr.rectangle(where[0], where[1], max_w, max_h)
        cr.clip()

        # Find bounds on highlighted modules
        hl_bounds = self._find_highlighted_bounds(highlights)
        bound_width = hl_bounds[2] - hl_bounds[0]
        bound_height = hl_bounds[3] - hl_bounds[1]
        bound_centre_x = hl_bounds[0] + bound_width/2
        bound_centre_y = hl_bounds[1] + bound_height/2

        # Scale to either 1.5:1 or smaller if necessary to fit bounds
        scale_x = max_w / bound_width
        scale_y = max_h / bound_height
        scale = min(min(1.5, scale_x), min(1.5, scale_y))
        cr.scale(scale, scale)

        # Can we shift the top edge of the PCB to the top and not cut off
        # the bottom of the highlight?
        if hl_bounds[3] - self.bounds[1] < max_h/scale:
            shift_y = -self.bounds[1]

        # Can we shift the bottom edge of the PCB to the bottom and not cut off
        # the top of the highlight?
        elif self.bounds[3] - hl_bounds[1] < max_h/scale:
            shift_y = -self.bounds[3] + max_h/scale

        # Otherwise centre the highlighted region vertically
        else:
            shift_y = (max_h/(2*scale))-bound_centre_y

        # Can we shift the left edge of the PCB to the left and not cut off
        # the right of the highlight?
        if hl_bounds[2] - self.bounds[0] < max_w/scale:
            shift_x = -self.bounds[0]

        # Can we shift the right edge of the PCB to the right and not cut off
        # the left of the highlight?
        elif self.bounds[2] - hl_bounds[0] < max_w/scale:
            shift_x = -self.bounds[2] + max_w/scale

        # Otherwise centre the highlighted region horizontally
        else:
            shift_x = (max_w/(2*scale))-bound_centre_x

        cr.translate(shift_x, shift_y)

        # Translate our origin to desired position on page
        cr.translate(where[0]/scale, where[1]/scale)

        # Render highlights below everything else
        cr.set_source_rgb(1.0, 0.5, 0.5)
        for module in self.modules:
            if module.ref in highlights:
                module.render_highlight(cr)

        # Render modules
        cr.set_source_rgb(0, 0, 0)
        for module in self.modules:
            module.render(cr)

        # Render edge lines
        for line in self.edge_lines:
            cr.move_to(*line[0])
            cr.line_to(*line[1])
            cr.stroke()

        # Render edge arcs
        for arc in self.edge_arcs:
            cr.new_sub_path()
            cr.arc(*arc)
            cr.stroke()

        cr.restore()
Render the PCB, with the top left corner at `where`,
dataset/ETHPy150Open adamgreig/agg-kicad/scripts/stickerbom.py/PCB.render