Also alphabetizes columns and returns a tuple of tuples

def tupleize(
    rows,
    alphabetize_columns=getattr(
        settings,
        'ALPHABETIZE_COLUMNS',
        False)):
    """Also alphabetizes columns and returns a tuple of tuples"""

    # define a blank list as our return object
    l = []
    for r in rows:
        row = []
        row = list(r.values())
        l.append(row)

    # alphabetize
    if alphabetize_columns:
        col = sorted(zip(*l))
        result = zip(*col)
        return result
    else:
        return l