def java_string_hash(key):
    """ If key is a string, compute its java .hash() code. Taken from http://garage.pimentech.net/libcommonPython_src_python_libcommon_javastringhashcode/ """
    h = 0
    for c in key:
        h = 31 * h + ord(c) & 4294967295
    return (h + 2147483648 & 4294967295) - 2147483648
