```\nfunction \_borrow(\n    address \_market,\n    address \_tokenAddr,\n    uint256 \_amount,\n    uint256 \_rateMode,\n    address \_to,\n    address \_onBehalf\n) internal returns (uint256) {\n    ILendingPoolV2 lendingPool = getLendingPool(\_market);\n\n    // defaults to onBehalf of proxy\n    if (\_onBehalf == address(0)) {\n        \_onBehalf = address(this);\n    }\n\n    lendingPool.borrow(\_tokenAddr, \_amount, \_rateMode, AAVE\_REFERRAL\_CODE, \_onBehalf);\n\n    \_tokenAddr.withdrawTokens(\_to, \_amount);\n\n    logger.Log(\n        address(this),\n        msg.sender,\n        "AaveBorrow",\n        abi.encode(\_market, \_tokenAddr, \_amount, \_rateMode, \_to, \_onBehalf)\n    );\n\n    return \_amount;\n}\n```\n