def md5_shard(word):
 data = word.encode('utf-8')
 return ('server%d' % (hashlib.md5(data).digest()[(-1)] % 4))

def md5_shard ( word ) : data = word . encode ( 'utf-8' ) return ( 'server%d' % ( hashlib . md5 ( data ) . digest ( ) [ ( - 1 ) ] % 4 ) )
do a great job of assigning data to servers using a hash value .