checkArgument function

Perform basic checks on a function argument.