Support keyword arguments when checking for valid arity.

Fixes #431.