binascii.a2b_hex()

binascii.a2b_hex(hexstr) → s; Binary data of hexadecimal representation.

hexstr must contain an even number of hex digits (upper or lower case). This function is also available as “unhexlify()”