async def shell(self, command: str, take_screenshot=True):
        """Run a shell command and return the output, error, and optionally a screenshot."""
        _, stdout, stderr = await run(command)
        result = {"text": stdout}
        if stderr:
            result["text"] += f"\nError: {stderr}"

        if take_screenshot:
            # delay to let things settle before taking a screenshot
            await asyncio.sleep(self._screenshot_delay)
            screenshot_result = await self.screenshot()
            result = {
                "type": "image",
                "text": result["text"],
                "source": screenshot_result["source"]
            }

        return result
Run a shell command and return the output, error, and optionally a screenshot.
src/upsonic/server/level_utilized/cu/computer.py