def draw_border_on_area(surf, color, area_rect, thickness=1):
    """Draw a border on surf on given area.

    It works by drawing a sequence of rects with thickness
    1, one inside the other.

    Parameters
    ==========
    surf (pygame.Surface instance)
        surface wherein to draw the border
    color (pygame.Color instance or sequence)
        contains integers from 0 to 255 inclusive,
        representing values for red, green and blue channels
        of a color.
    area_rect (pygame.Rect or compatible)
        rect describing area inside given surf wherein to
        draw the border.
    thickness (integer)
        represents the desired width of the border in pixels.
    """
    ### starting from 0 (zero), get an amount of deflation
    ### from 0 to the double of the thickness, in increments
    ### of 2

    for deflation in range(0, thickness * 2, 2):

        ## for each amount of deflation, draw a deflated
        ## rect in that area on the given surface with
        ## thickness 1

        draw_rect(surf, color, area_rect.inflate(-deflation, -deflation), 1)
Draw a border on surf on given area.

    It works by drawing a sequence of rects with thickness
    1, one inside the other.

    Parameters
    ==========
    surf (pygame.Surface instance)
        surface wherein to draw the border
    color (pygame.Color instance or sequence)
        contains integers from 0 to 255 inclusive,
        representing values for red, green and blue channels
        of a color.
    area_rect (pygame.Rect or compatible)
        rect describing area inside given surf wherein to
        draw the border.
    thickness (integer)
        represents the desired width of the border in pixels.
    
nodezator/surfsman/draw.py