Python: String: Sort Types

Write the function sort_type that take a string and returns another string whose characters are sorted by their types based on the following criteria: First, lower case characters sorted alphabetically followed by upper case characters. Second, numbers sorted in descending order. Third, punctuation should be sorted as !,-.:;?. Any other character not mentioned above should be removed from the string.


sort_type('we all agreed; it was 3 magnificent evenings!') -> 'aaaacdeeeeeefgggiiiillmnnnnrssttvww3!;'

Test 1    

Test 2    

Test 3    

Test 4    

Test 5    

Test 6