Implement a safe method for calculating softmax.
The function must accept a non-empty list of numeric logits and return a list of probabilities in the same order. Use a numerically stable computation that avoids overflow for large values. For example, [1.0, 2.0, 3.0] produces approximately [0.0900, 0.2447, 0.6652], while [1000.0, 1001.0] produces approximately [0.2689, 0.7311].
softmax(logits)1.0.def softmax(logits):