def check_var(var, var_types:Union[type, List[type]] =None, var_name=None, enforce_not_none:bool = True,<EOL>allowed_values:Set = None, min_value = None, min_strict:bool = False,<EOL>max_value = None, max_strict:bool = False, min_len:int = None, min_len_strict:bool = False,<EOL>max_len:int = None, max_len_strict:bool = False):
var_name = var_name or '<STR_LIT:object>'<EOL>if enforce_not_none and (var is None):<EOL><INDENT>raise MissingMandatoryParameterException('<STR_LIT>' + var_name + '<STR_LIT>')<EOL><DEDENT>if not (var is None) and not (var_types is None):<EOL><INDENT>if not isinstance(var_types, list):<EOL><INDENT>var_types = [var_types]<EOL><DEDENT>match = False<EOL>for var_type in var_types:<EOL><INDENT>if var_type is Callable:<EOL><INDENT>if callable(var):<EOL><INDENT>match = True<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(var, var_type):<EOL><INDENT>match = True<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if not match:<EOL><INDENT>raise TypeError('<STR_LIT>' + var_name + '<STR_LIT>' + str(var_types) + '<STR_LIT>' + str(type(var)))<EOL><DEDENT><DEDENT>if var is not None:<EOL><INDENT>if allowed_values is not None:<EOL><INDENT>if var not in allowed_values:<EOL><INDENT>raise TypeError('<STR_LIT>' + var_name + '<STR_LIT>' + str(allowed_values) + '<STR_LIT>' + str(var))<EOL><DEDENT><DEDENT>if min_value is not None:<EOL><INDENT>if min_strict:<EOL><INDENT>if not (var > min_value):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(min_value) + '<STR_LIT>' + str(var))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not (var >= min_value):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(min_value) + '<STR_LIT>' + str(var))<EOL><DEDENT><DEDENT><DEDENT>if max_value is not None:<EOL><INDENT>if max_strict:<EOL><INDENT>if not (var < max_value):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(max_value) + '<STR_LIT>' + str(var))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not (var <= max_value):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(max_value) + '<STR_LIT>' + str(var))<EOL><DEDENT><DEDENT><DEDENT>if min_len is not None:<EOL><INDENT>if min_len_strict:<EOL><INDENT>if not (len(var) > min_len):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(min_len) + '<STR_LIT>' + str(len(var)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not (len(var) >= min_len):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(min_len) + '<STR_LIT>' + str(len(var)))<EOL><DEDENT><DEDENT><DEDENT>if max_len is not None:<EOL><INDENT>if max_len_strict:<EOL><INDENT>if not (len(var) < max_len):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(max_len) + '<STR_LIT>' + str(len(var)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not (len(var) <= max_len):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' + var_name + '<STR_LIT>' + str(max_len) + '<STR_LIT>' + str(len(var)))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Helper method to check that an object has certain properties:
* not none
* a certain type
* in some accepted values
* in some accepted range

:param var: the object to check
:param var_types: the type(s) to enforce. If None, type will not be enforced
:param var_name: the name of the varioable to be used in error messages
:param enforce_not_none: boolean, default True. Whether to enforce that var is not None.
:param allowed_values: an optional set of allowed values
:param min_value: an optional minimum value
:param min_strict: if True, only values strictly greater than the minimum value will be accepted
:param max_value: an optional maximum value
:param max_strict: if True, only values strictly lesser than the minimum value will be accepted
:return: