code: def _normalizeRect(self, x, y, width, height):
          
          x, y = self._normalizePoint(x, y) # inherit _normalizePoint logic
  
          assert width is None or isinstance(width, _INTTYPES), 'width must be an integer or None, got %s' % repr(width)
          assert height is None or isinstance(height, _INTTYPES), 'height must be an integer or None, got %s' % repr(height)
  
          # if width or height are None then extend them to the edge
          if width is None:
              width = self.width - x
          elif width < 0: # handle negative numbers
              width += self.width
              width = max(0, width) # a 'too big' negative is clamped zero
          if height is None:
              height = self.height - y
              height = max(0, height)
          elif height < 0:
              height += self.height
  
          # reduce rect size to bounds
          width = min(width, self.width - x)
          height = min(height, self.height - y)
  
          return x, y, width, height
docs: Check if the rectangle is in bounds and make minor adjustments.
          raise AssertionError's for any problems