Python not standart list sorting : <p>Let's say I have a list like this: <code>[2, 3, 3, 2, 1, 1]</code> and I want to sort it to get   <code>[1, 1, 3, 3, 2, 2]</code>. How I can do it in good pythonic way? I've tried like this:</p>

<pre><code>import random
alist = [1, 1, 2, 2, 3, 3]
random.shuffle(alist)

print(alist)

ones = []
twos = []
threes = []

for item in alist:
    if item == 1:
        ones.append(item)
    elif item == 2:
        twos.append(item)
    else:
        threes.append(item)

ordered_list = []
ordered_list.extend(ones)
ordered_list.extend(threes)
ordered_list.extend(twos)

print(ordered_list)
</code></pre>

<p>But I guess it's not the best way to do it. Maybe there is a better way?</p>
