Construct the Dirxml-Associations value from the AD GUID

How can i construct the Dirxml-Associations value for an user object using the AD GUID of the user. This is necessary to construct the LDIF. There was a cool solution link which i followed earlier in 2015 which I couldn't find any more.

Please help