def sanitized_games(games):
    """ Sanitizes a list of games into result tuples for rating.
    A result tuple is the form (w, b, result, date, handicap, komi)
    Where 'result' is 1 if w won and 0 otherwise.
    """

    g_vec = []
    for g in games:
        if g.white.user_id is None or g.black.user_id is None:
            print('No ids        :  ', g) #should probably strip them from the db.
            pass
        elif g.handicap > 1 and (-1 > g.komi > 1):
            #print('bad komi      :  ', g)
            pass
        elif g.handicap > 6:
            continue
        elif g.komi < 0 or g.komi > 8.6:
            #print('bad komi      :  ', g)
            pass
        elif not (g.result.startswith('W') or g.result.startswith('B')):
            print('unknown result:  ', g)
            pass
        elif g.date_played is None or g.date_played.timestamp() == 0.0:
            print('No date played:  ', g)
            pass
        else:
            # Vector of result_tuples.  Just what we need to compute ratings...
            g_vec.append( (g.white.id, 
                         g.black.id,
                         1.0 if g.result.startswith('W') else 0.0,
                         g.date_played.timestamp(),
                         g.handicap,
                         g.komi)) 
    return g_vec