Blender 2.81 - Copy cursor rotation to an object
Snap to cursor with code

Quick little script to copy either or both of cursor location, rotation to selected objects.

import bpy
from mathutils import Matrix

use_rotation = True # use cursor rot
use_location = True #  "    "    loc

context = bpy.context

cursor = context.scene.cursor

tc, qc, sc = cursor.matrix.decompose()

for ob in context.selected_objects:
    to, qo, so = ob.matrix_world.decompose()

    R = qc.to_matrix().to_4x4() if use_rotation else qo.to_matrix().to_4x4()

    T = Matrix.Translation(tc) if use_location else Matrix.Translation(to)

    S = Matrix.Diagonal(so).to_4x4()

    ob.matrix_world = T @ R @ S