Ldap hiera variable lookup

I was searching for a way for Puppet to get, via Hiera, variables in LDAP for parameterized classes. And found Arnaud Gomes code. Maybe it is useful for more people. It is possible to put hashes in ldap variables via JSON. 

Warning: it does not work with any LDAP filter anymore, just for the purpose of Hiera variable lookup.