The Isle of Man is set to become the first UK territory to legalise assisted dying, with legislation nearing final approval in Tynwald.