def rotate_object_around_axis(obj, axis, std, angle=None):
    """
    Rotate an object around a given axis.
    """
    # Normalize the axis
    axis = np.array(axis)
    normalized_axis = axis / np.linalg.norm(axis)

    # If no angle is provided, generate a random angle between 0 and 2*pi
    if angle is None:
        angle = np.random.normal(0, std)

    obj.rotation_mode = "AXIS_ANGLE"
    obj.rotation_axis_angle = Vector([angle] + list(normalized_axis))

    Rotate an object around a given axis.
    
infinigen/core/constraints/example_solver/geometry/dof.py