def _overlaps(media_a, media_b):
    """Determines if two TrackMedia overlap."""
    a1 = media_a.start
    a2 = media_a.start + media_a.duration - 1
    b1 = media_b.start
    b2 = media_b.start + media_b.duration - 1
    return a1 <= b2 and b1 <= a2
