def METHOD_NAME(key):
    "Generate hash for given key"
    key = encodeUnicodeToBytes(key)  # if key is not unicode, then it is not changed
    if not isinstance(key, bytes):
        raise NotImplementedError
    keyhash = hashlib.md5()
    keyhash.update(encodeUnicodeToBytesConditional(key, condition=PY3))
    return keyhash.hexdigest()