Avoiding useless string conversion and returning bytearray.