Return a variable if it matches an expected type.
variable – Variable to check.
variablename (str) – Variable name for error message.
expect (type) – Expected variable type.
default – Default value, if varibale is None.
None
TypeError – If variable does not match expected type.