For the bytes/string palette? Yes, but I would keep the `alpha_bytes` variable to make the code more readable.
For example, you need only 16 colors if you store a paletted image with 4 bits.
I would also swap the if statements and check for `int` instead of `bytes` (because transparency might be a string on Python 2).

PS: `b'\xff' * 4` is `b'\xff\xff\xff\xff'`