Dynamo in Revit

Can anyone help in explaining how to rotate the building model containing sun paths and to arrive the best possible orientation using dynamo scripts in Revit?