I am looking for Python function that would compute distance from a point in 3D (x_0,y_0,z_0) to a line segment defined by its endpoints (x_1,y_1,z_1) and (x_2,y_2,z_2).
I have only found solution for 2D for this problem.
There are solutions to finding a distance from a point to a line in 3d, but not to a line segment, like here:
(picture taken from Calculate distance point to line segment with special cases)