Extract a #valid? method.