code: def write_to_screen(self, cli, screen, mouse_handlers, write_position):
          
          sizes = self._divide_heigths(cli, write_position)
  
          if self.report_dimensions_callback:
              self.report_dimensions_callback(cli, sizes)
  
          if sizes is None:
              self.window_too_small.write_to_screen(
                  cli, screen, mouse_handlers, write_position)
          else:
              # Draw child panes.
              ypos = write_position.ypos
              xpos = write_position.xpos
              width = write_position.width
  
              for s, c in zip(sizes, self.children):
                  c.write_to_screen(cli, screen, mouse_handlers, WritePosition(xpos, ypos, width, s))
                  ypos += s
docs: Render the prompt to a `Screen` instance.
  
          :param screen: The :class:`~prompt_toolkit.layout.screen.Screen` class
              to which the output has to be written.