def draw_rect(canvas, pos, size, line_width, line_color, fill_color=None):
    """
    Draw a rectangle.

    :param canvas: simplegui.Canvas
    :param pos: (int or float, int or float) or [int or float, int or float]
    :param size: (int or float, int or float) or [int or float, int or float]
    :param line_width: int >= 0
    :param line_color: str
    :param fill_color: str
    """
    assert isinstance(pos, (tuple, list)), type(pos)
    assert len(pos) == 2, len(pos)
    assert isinstance(pos[0], (int, float)), type(pos[0])
    assert isinstance(pos[1], (int, float)), type(pos[1])
    assert isinstance(size, (tuple, list)), type(size)
    assert len(size) == 2, len(size)
    assert isinstance(size[0], (int, float)), type(size[0])
    assert isinstance(size[1], (int, float)), type(size[1])
    assert isinstance(line_width, (int, float)), type(line_width)
    assert line_width >= 0, line_width
    assert isinstance(line_color, str), type(str)
    assert fill_color is None or isinstance(fill_color, str), type(str)
    x0 = pos[0]
    y0 = pos[1]
    width = size[0] - 1
    height = size[1] - 1
    canvas.draw_polygon(((x0, y0), (x0 + width, y0), (x0 + width, y0 +
        height), (x0, y0 + height)), line_width, line_color, fill_color)
