def draw_frame(surface, rect, color_fill, color_border, border=1):
    """
    Creates and draws a rect with a frame. Returns the inside rect object.
    returns a pygame.Rect() object, which is the filled area inside the frame
    - surface: the pygame surface to draw this on
    - rect: pygame.Rect() object for the outer frame
    - color_fill, color_border: pygame.Color() object for fill and the border
    - border: border thickness, in pixel (an int)
    """
    surface.fill(color_border, rect)
    inside_rect = rect.inflate(-border*2, -border*2)
    surface.fill(color_fill, inside_rect)
    return inside_rect