What is the use of the "sorted" function in Python?