In my case, it was a matter of changing from rawTransaction to raw_transaction, as in making sure the case styles are consistent in the version of web3py you're using. Because I see you're using even toHex instead of to_hex. so verify this.
rawTransaction
raw_transaction
toHex
to_hex.