def validate_read_preference_mode(dummy, name):
 try:
  return read_pref_mode_from_name(name)
 except ValueError:
  raise ValueError(('%s is not a valid read preference' % (name,)))

def validate_read_preference_mode ( dummy , name ) : try : return read_pref_mode_from_name ( name ) except ValueError : raise ValueError ( ( '%s is not a valid read preference' % ( name , ) ) )
validate read preference mode for a mongoreplicasetclient .