```\\nfunction _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\\n    // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\\n    // then delete the last slot (swap and pop).\\n\\n    uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;\\n    uint256 tokenIndex = _ownedTokensIndex[tokenId];\\n\\n    // When the token to delete is the last token, the swap operation is unnecessary\\n    if (tokenIndex != lastTokenIndex) {\\n        uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\\n\\n        _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n        _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n    }\\n\\n    // This also deletes the contents at the last position of the array\\n    delete _ownedTokensIndex[tokenId];\\n    delete _ownedTokens[from][lastTokenIndex];\\n}\\n```\\n