def rectangle(terminal, position, dimension):
    """
    Draw a rectangle

    @type position: L{tuple}
    @param position: A tuple of the (top, left) coordinates of the rectangle.
    @type dimension: L{tuple}
    @param dimension: A tuple of the (width, height) size of the rectangle.
    """
    (top, left) = position
    (width, height) = dimension
    terminal.selectCharacterSet(insults.CS_DRAWING, insults.G0)

    terminal.cursorPosition(top, left)
    terminal.write(chr(0o154))
    terminal.write(chr(0o161) * (width - 2))
    terminal.write(chr(0o153))
    for n in range(height - 2):
        terminal.cursorPosition(left, top + n + 1)
        terminal.write(chr(0o170))
        terminal.cursorForward(width - 2)
        terminal.write(chr(0o170))
    terminal.cursorPosition(0, top + height - 1)
    terminal.write(chr(0o155))
    terminal.write(chr(0o161) * (width - 2))
    terminal.write(chr(0o152))

    terminal.selectCharacterSet(insults.CS_US, insults.G0)

    Draw a rectangle

    @type position: L{tuple}
    @param position: A tuple of the (top, left) coordinates of the rectangle.
    @type dimension: L{tuple}
    @param dimension: A tuple of the (width, height) size of the rectangle.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/insults/window.py