def make_safe_digest(string, hash_func=hashlib.sha1):
 return force_text(hash_func(string.encode('utf-8')).hexdigest())

def make_safe_digest ( string , hash_func = hashlib . sha1 ) : return force_text ( hash_func ( string . encode ( 'utf-8' ) ) . hexdigest ( ) )
return a hex digest of string .