Make the script portable to both pythons

Make the script work for python3 and for python2
diff --git a/tests/scripts/mbedtls_test.py b/tests/scripts/mbedtls_test.py
index 62c2296..b7b9dc0 100755
--- a/tests/scripts/mbedtls_test.py
+++ b/tests/scripts/mbedtls_test.py
@@ -270,7 +270,7 @@
                 data_bytes += b'S'
                 self.align_32bit(data_bytes)
                 data_bytes += self.int32_to_big_endian_bytes(i)
-                data_bytes += bytes(param, 'ascii')
+                data_bytes += bytearray(param, encoding='ascii')
                 data_bytes += b'\0'   # Null terminate
             elif typ == 'hex':
                 binary_data = self.hex_str_bytes(param)
@@ -309,7 +309,7 @@
 
         param_bytes, length = self.test_vector_to_bytes(function_id,
                                                         dependencies, args)
-        self.send_kv(length.hex(), param_bytes.hex())
+        self.send_kv(''.join('{:02x}'.format(x) for x in length), ''.join('{:02x}'.format(x) for x in param_bytes))
 
     @staticmethod
     def get_result(value):