def real_user_or_none(user):
 assert ((user is None) or user.is_anonymous() or isinstance(user, get_user_model()))
 return (user if (user and (not user.is_anonymous())) else None)

def real_user_or_none ( user ) : assert ( ( user is None ) or user . is_anonymous ( ) or isinstance ( user , get_user_model ( ) ) ) return ( user if ( user and ( not user . is_anonymous ( ) ) ) else None )
convert anonymous user to none .