Select ending edges

Hi, in python how would I select start or end edges of a quad strip?

G0UBXztgVd