can u suuggest the python equvalent for the following code in tcl

allG12MOs = [lsort -dictionary -command "SortMO moty" [array names moty] ]

moty is a list