Select all the last vertices of every branch I'm modeling a tree trunk with the use of the skin modifier. Is it possible to automatically select the last vertex of every branch? Preferably with Python.

Top view of the tree trunk with several last vertices selected
Select verts with only one linked edge

import bpy
import bmesh

context = bpy.context

ob = context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
for v in bm.verts:
    v.select = len(v.link_edges) == 1

bmesh.update_edit_mesh(me)