```\nfunction getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n    assembly {\n        let len := returndatasize()\n        if gt(len, maxLen) {\n            len := maxLen\n        }\n        let ptr := mload(0x40)\n        mstore(0x40, add(ptr, add(len, 0x20)))\n        mstore(ptr, len)\n        returndatacopy(add(ptr, 0x20), 0, len)\n        returnData := ptr\n    }\n}\n```\n