(columns)
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

    >>> prioritySortColumns(['password', 'userid', 'name'])
    ['userid', 'name', 'password']
Sorts given column names by length in ascending order while those containing
    string 'id' go first
Sorts given column names by length in ascending order while those containing string id go first
def prioritySortColumns(columns):
    """
    Sorts given column names by length in ascending order while those containing
    string 'id' go first

    >>> prioritySortColumns(['password', 'userid', 'name'])
    ['userid', 'name', 'password']
    """

    _ = 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 )