def timeline_trimmed_to_range(in_timeline, trim_range):
    "Returns a new timeline that is a copy of the in_timeline, but with items\n    outside the trim_range removed and items on the ends trimmed to the\n    trim_range. Note that the timeline is never expanded, only shortened.\n    Please note that you could do nearly the same thing non-destructively by\n    just setting the Track's source_range but sometimes you want to really cut\n    away the stuff outside and that's what this function is meant for."
    new_timeline = copy.deepcopy(in_timeline)
    for (track_num, child_track) in enumerate(in_timeline.tracks):
        new_timeline.tracks[track_num] = track_algo.track_trimmed_to_range(child_track, trim_range)
    return new_timeline
Returns a new timeline that is a copy of the in_timeline, but with items
outside the trim_range removed and items on the ends trimmed to the
trim_range. Note that the timeline is never expanded, only shortened.
Please note that you could do nearly the same thing non-destructively by
just setting the Track's source_range but sometimes you want to really cut
away the stuff outside and that's what this function is meant for.
def timeline_trimmed_to_range(in_timeline, trim_range):
    "Returns a new timeline that is a copy of the in_timeline, but with items\n    outside the trim_range removed and items on the ends trimmed to the\n    trim_range. Note that the timeline is never expanded, only shortened.\n    Please note that you could do nearly the same thing non-destructively by\n    just setting the Track's source_range but sometimes you want to really cut\n    away the stuff outside and that's what this function is meant for."
    new_timeline = copy.deepcopy(in_timeline)
    for (track_num, child_track) in enumerate(in_timeline.tracks):
        new_timeline.tracks[track_num] = track_algo.track_trimmed_to_range(child_track, trim_range)
    return new_timeline