<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_max(self):
 """ Delete the right-most value from a tree. """


        # Attempt to rotate left-leaning reds to the right.
        if self.left.red:
            self = self.rotate_right()

        # Base case: If there are no selfs greater than this self, then this is
        # the self to delete.
        if self.right is NULL:
            return NULL, self.value

        # Acquire more reds if necessary to continue the traversal. NULL is
        # red so this check doesn't need to check for NULL.
        if not self.right.red and not self.right.left.red:
            self = self.move_red_right()

        # Recursive case: Delete the maximum self of all selfs greater than this
        # self.
        right, value = self.right.delete_max()
        self = self._replace(right=right)

        return self.balance(), value