How can I access bone's 'animation_data.action'? This is the script I've got. It just basically offsets every selected objects animation for the other one as shown in this Tutorial 

import bpy
obj = bpy.context.selected_objects
objlist = len(obj)
offset = range(objlist+1)

for i in range(objlist):
    animData = obj[i].animation_data
    action = animData.action
    fcurves = action.fcurves
    for curve in fcurves:
        keyframePoints = curve.keyframe_points
        for keyframe in keyframePoints:
            keyframe.co[0] += offset[i]
            keyframe.handle_left[0] += offset[i]
            keyframe.handle_right[0] += offset[i]


It works alright but when I change it to:

import bpy

obj = bpy.context.selected_pose_bones
objlist = len(obj)
offset = range(objlist+1)

for i in range(objlist):
    animData = obj[i].animation_data
    action = animData.action
    fcurves = action.fcurves
    for curve in fcurves:
        keyframePoints = curve.keyframe_points
        for keyframe in keyframePoints:
            keyframe.co[0] += offset[i]
            keyframe.handle_left[0] += offset[i]
            keyframe.handle_right[0] += offset[i]


I get this error


  AttributeError:'PoseBone' object has no attribute 'animation_data'
Armatures store data differently than other objects, they contain a rest position for each bone that locates the bone within the armature structure as well as pose position used for animation. The data for an action is stored within a generic objects data, to get the armature animation data you want, you need to treat the armature as an object to get there. The path to the fcurves of the armatures action is 

bpy.context.active_object.animation_data.action.fcurves


The list of fcurves in the armatures action will contain every curve for every channel of every bone in the armature that is keyframed, each curve has a data_path with a value like pose.bones["hips"].location, by extracting the name you can compare it to the selected bone names with something like -

bone_names = [b.name for b in bpy.context.selected_pose_bones]
...
for curve in fcurves:
    if curve.data_path.split('"')[1] in bone_names:
        # do stuff