When run alone in the GUI, this code randomly rotates an object as is required.
def rotate_piece(pieces, model_names): bpy.data.objects[\'00000_\'+mod