def METHOD_NAME(
    scene_node: SceneNode, theta: float, axis: int, constraint: Optional[float] = None
) -> None:
    if constraint is not None:
        rotation = scene_node.rotation
        if (
            abs(float(rotation.angle())) > 0
            and 1.0 - abs(rotation.axis().normalized()[axis]) > 1e-3
        ):
            raise RuntimeError(
                "Constrained look only works for a singular look action type"
            )
        look_vector = rotation.transform_vector(FRONT)
        if axis == 0:
            look_angle = mn.Rad(np.arctan2(look_vector[1], -look_vector[2]))
        elif axis == 1:
            look_angle = -mn.Rad(np.arctan2(look_vector[0], -look_vector[2]))
        new_angle = look_angle + mn.Deg(theta)
        constraint = mn.Deg(constraint)
        if new_angle > constraint:
            theta = constraint - look_angle
        elif new_angle < -constraint:
            theta = -constraint - look_angle
    _rotate_local_fns[axis](scene_node, mn.Deg(theta))
    scene_node.rotation = scene_node.rotation.normalized()