Convert the string to an integer base 16 then to hexadecimal.
print hex(int(string, base=16))
These are built-in functions.
http://docs.python.org/2/library/functions.html#int
Example
>>> string = 'AA'
>>> _int = int(string, base=16)
>>> _hex = hex(_int)
>>> print _int
170
>>> print _hex
0xaa
>>>