konrad.utils.return_if_type

konrad.utils.return_if_type(variable, variablename, expect, default)[source]

Return a variable if it matches an expected type.

Parameters
  • variable – Variable to check.

  • variablename (str) – Variable name for error message.

  • expect (type) – Expected variable type.

  • default – Default value, if varibale is None.

Raises

TypeError – If variable does not match expected type.