def sha_to_hex(sha):
 hexsha = binascii.hexlify(sha)
 assert (len(hexsha) == 40), ('Incorrect length of sha1 string: %d' % hexsha)
 return hexsha

def sha_to_hex ( sha ) : hexsha = binascii . hexlify ( sha ) assert ( len ( hexsha ) == 40 ) , ( 'Incorrect length of sha1 string: %d' % hexsha ) return hexsha
takes a string and returns the hex of the sha within .