def check_valid(msg_type, attr, value, func, exec_info):
if value is not None:<EOL><INDENT>if isinstance(value, MutableSequence):<EOL><INDENT>for v in value:<EOL><INDENT>if not func(v):<EOL><INDENT>raise InvalidMessageInputError(msg_type, attr, value, exec_info)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if not func(value):<EOL><INDENT>raise InvalidMessageInputError(msg_type, attr, value, exec_info)<EOL><DEDENT><DEDENT><DEDENT>
Checker function all validate_* functions below will call.
Raises InvalidMessageInputError if input is not valid as per
given func.