Uruguay has become the first country in predominantly Catholic Latin America to allow euthanasia via legislation.