hexadecimal_string = "AB"
byte_array = bytearray.fromhex(hexadecimal_string)
print(byte_array)
>>> b'xdexadxbexef'.hex()
'deadbeef'
>>> bytes.fromhex('deadbeef')
b'xdexadxbexef'
#Hex -> Bytes
>>> b'xdexadxbexef'.hex()
'deadbeef'
#Bytes -> Hex
>>> bytes.fromhex('deadbeef')
b'xdexadxbexef'