Renesas RA6M3 embed

I am currently following the guide here: www.pelion.com/.../renesas-sdk.html for connecting my RA6M3 module to the Pelion Device Managament.
But on the step for the execution of the imgtool.py, 
python ../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py sign --layout ../flash_layout/flash_layout.h  --align 8 --header-size 0x400 __Renesas_EK_RA6M3/Release/mbedCloudClientExample.bin mbedCloudClientExample_signed.bin -k ../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/Signing_Key/signingkey.pem
I am getting the following error:


Traceback (most recent call last):
  File "../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py", line 23, in <module>
    from imgtool_lib import image
  File "/home/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/image.py", line 21, in <module>
    from . import boot_record as br
  File "/home/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/boot_record.py", line 52
    'be even (key + value).', file=sys.stderr)
                                  ^
SyntaxError: invalid syntax

I tried to correct it by eliminating the "file=sys.stderr" in the print commands.
But in that case, I get another error:
**[INFO]** Image version number set to 0.0.0+1
Traceback (most recent call last):
  File "../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py", line 216, in <module>
    args()
  File "../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py", line 213, in args
    subcmds[args.subcmd](args)
  File "../r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool.py", line 122, in do_sign
    img.sign(sw_type, key, ram_load_address, args.dependencies)
  File "/home/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/image.py", line 212, in sign
    sig = key.sign(self.payload)
  File "/home/cris/mbed/r01an5347eu0110-ra-arm-secure-boot-solution-ra6m3/SecureBoot_Package/scripts/image_creation/imgtool_lib/keys.py", line 114, in sign
    algorithm=SHA256()
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/rsa.py", line 413, in sign
    self._backend, data, algorithm
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/utils.py", line 17, in _calculate_digest_and_algorithm
    hash_ctx.update(data)
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/hashes.py", line 92, in update
    raise TypeError("data must be bytes.")
TypeError: data must be bytes.
Kindly let me know how to proceed.