code: def render(panel, width=50) -> str:
      console = Console(
          file=io.StringIO(), width=50, legacy_windows=False
      )
      console.print(panel)
      return console.file.getvalue()
  
file_path: rich/tests/test_panel.py
imports: import io
  import pytest
  from rich.console import Console
  from rich.panel import Panel
  from rich.segment import Segment
  from rich.style import Style
label_desc: Use image node_id 1 for calling a global function with example usage: render(panel, width) and returns: console