Helper functions with a consistent interface to coerce and verify the types and shapes of values for input checking.