def simple_first(kv):
 return (isinstance(kv[1], (list, dict, tuple)), kv[0])

def simple_first ( kv ) : return ( isinstance ( kv [ 1 ] , ( list , dict , tuple ) ) , kv [ 0 ] )
helper function to pass to item_sort_key to sort simple elements to the top .