```\nfunction takeFee(address sender, uint amount) internal returns (uint) {\n    uint feeAmount = (amount * fee) / 100 / 2;\n    balanceOf[address(this)] = balanceOf[address(this)] + feeAmount;\n\n    emit Transfer(sender, address(this), feeAmount);\n\n    return amount - feeAmount;\n}\n```\n