def hash(value, algorithm='sha512'):
    if hasattr(hashlib, 'algorithms') and algorithm in hashlib.algorithms:
        hasher = hashlib.new(algorithm)
        hasher.update(value)
        out = hasher.hexdigest()
    elif hasattr(hashlib, algorithm):
        hasher = hashlib.new(algorithm)
        hasher.update(value)
        out = hasher.hexdigest()
    else:
        raise SaltInvocationError('You must specify a valid algorithm.')

    return out
Set the memcache policy function.
dataset/ETHPy150Open saltstack/salt/salt/modules/mod_random.py/hash--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/ndb/context.py/Context.set_memcache_policy