def METHOD_NAME(id_data, data_fcurves=True):
    """Given a Blender ID, yields its FCurves"""
    def _fetch(source):
        if source is not None and source.action is not None:
            for i in source.action.fcurves:
                yield i
    # This seems rather unpythonic IMO
    for i in _fetch(id_data.animation_data):
        yield i
    if data_fcurves:
        for i in _fetch(id_data.data.animation_data):
            yield i