Convert simply python script to animation node setup
binweg's answer solves the problem perfectly. The only problem that might occur is with adding Euler angles. Flipping might occur which will lead to improper results as shown in the following picture (where no cube but a pentagon was used as base shape):



The problem can be got rid of by using quaternions math instead of Euler math as shown in the following setup:



Unfortunately for the 'Object Transform Input' to work properly with Quaternions, the Transform for the Rotation of the corresponding object (in this case the Empty) must be set to Quaternion (WXYZ) in the properties panel of the 3D View.