def prioritySortColumns(columns):
 _ = (lambda x: (x and ('id' in x.lower())))
 return sorted(sorted(columns, key=len), (lambda x, y: ((-1) if (_(x) and (not _(y))) else (1 if ((not _(x)) and _(y)) else 0))))

def prioritySortColumns ( columns ) : _ = ( lambda x : ( x and ( 'id' in x . lower ( ) ) ) ) return sorted ( sorted ( columns , key = len ) , ( lambda x , y : ( ( - 1 ) if ( _ ( x ) and ( not _ ( y ) ) ) else ( 1 if ( ( not _ ( x ) ) and _ ( y ) ) else 0 ) ) ) )
sorts given column names by length in ascending order while those containing string id go first .