def capture_screen(surface, rect=None):
    """Returns a copy of the surface <surface>, with restriction <rect>
        (None means the whole surface)"""
    if not rect:
        rect = surface.get_rect()
    return surface.copy().subsurface(rect).convert()
