If I understand you right, the bone shall have the same rotation as its parent (in pose mode):

To achieve this by script, all you basically need is the rotation part of the parent. Construct a 4x4 transformation matrix from the parent rotation and the target bone's translation and scale. Assign it to the bone's matrix property.
import bpy
from mathutils import Matrix
pbone = bpy.context.active_pose_bone
pbone_parent = pbone.parent
loc = Matrix.Translation(pbone.matrix.to_translation())
# Rotation only (strip location and scale)
# TODO: make it work for parent bones with negative scale too
rot = pbone_parent.matrix.to_euler().to_matrix().to_4x4()
s = pbone.matrix.to_scale()
scale = Matrix()
scale[0][0] = s[0]
scale[1][1] = s[1]
scale[2][2] = s[2]
mat = loc * rot * scale
pbone.matrix = mat
# Force redraw, so transform properties are immediately visible
for area in bpy.context.screen.areas:
if area.type == 'PROPERTIES':
area.tag_redraw()
Note that the script has issues with negative scaled parent bones, couldn't figure out how to do it properly.