<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_rect(self, width, height, rid=None):
 """ Add new rectangle """

        assert(width > 0 and height > 0)
        if width > max(self.width, self.height) or\
            height > max(self.height, self.width):
            return None

        rect = None
        # If Waste managment is enabled, first try to place the rectangle there
        if self._waste_management:
            rect = self._waste.add_rect(width, height, rid)

        # Get best possible rectangle position
        if not rect:
            rect, _ = self._select_position(width, height)
            if rect:
                self._add_skyline(rect)

        if rect is None:
            return None
        
        # Store rectangle, and recalculate skyline
        rect.rid = rid
        self.rectangles.append(rect)
        return rect