<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clipRegionToScreen(self):
 """ Returns the part of the region that is visible on a screen If the region equals to all visible screens, returns Screen(-1). If the region is visible on multiple screens, returns the screen with the smallest ID. Returns None if the region is outside the screen. """

        if not self.isRegionValid():
            return None
        screens = PlatformManager.getScreenDetails()
        total_x, total_y, total_w, total_h = Screen(-1).getBounds()
        containing_screen = None
        for screen in screens:
            s_x, s_y, s_w, s_h = screen["rect"]
            if self.x >= s_x and self.x+self.w <= s_x+s_w and self.y >= s_y and self.y+self.h <= s_y+s_h:
                # Region completely inside screen
                return self
            elif self.x+self.w <= s_x or s_x+s_w <= self.x or self.y+self.h <= s_y or s_y+s_h <= self.y:
                # Region completely outside screen
                continue
            elif self.x == total_x and self.y == total_y and self.w == total_w and self.h == total_h:
                # Region equals all screens, Screen(-1)
                return self
            else:
                # Region partially inside screen
                x = max(self.x, s_x)
                y = max(self.y, s_y)
                w = min(self.w, s_w)
                h = min(self.h, s_h)
                return Region(x, y, w, h)
        return None