```\nfunction verifyCallResult(\n    bool success,\n    bytes memory returndata,\n    string memory errorMessage\n) internal pure returns (bytes memory) {\n    if (success) {\n        return returndata;\n    } else {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n```\n