Draw a rectangle with rounded four corners. Parameter <radius> specifies the radius of each corner.

def round_rectangle(self, style, fill, x1, y1, x2, y2, radius, shadow=None):
        """Draw a rectangle with rounded four corners. Parameter <radius> specifies the radius of each corner."""

        if invisible_p(x2, y2):
            return
        self.setbb(x1, y1)
        self.setbb(x2, y2)

        if fill:
            if shadow:
                x_off, y_off, shadow_fill = shadow
                self.gsave()
                self.newpath()
                self._path_round_rectangle(x1 + x_off, y1 + y_off, x2 + x_off, y2 + y_off,
                                           radius)
                self.closepath()
                self.clip_sub()
                self.fill_with_pattern(shadow_fill, x1 + x_off, y1 + y_off,
                                       x2 + x_off, y2 + y_off)
                self.grestore()

            self.gsave()
            self.newpath()
            self._path_round_rectangle(x1, y1, x2, y2, radius)
            self.closepath()
            self.clip_sub()
            self.fill_with_pattern(fill, x1, y1, x2, y2)
            self.grestore()
        if style:
            self.set_line_style(style)
            self.newpath()
            self._path_round_rectangle(x1, y1, x2, y2, radius)
            self.closepath()
            self.stroke()