MAINT: move the get_joint_endpoint_distn into a more generic module