def input_validate_str(string, name, max_len=None, exact_len=None):
if type(string) is not str:<EOL><INDENT>raise pyhsm.exception.YHSM_WrongInputType(name, str, type(string))<EOL><DEDENT>if max_len != None and len(string) > max_len:<EOL><INDENT>raise pyhsm.exception.YHSM_InputTooLong(name, max_len, len(string))<EOL><DEDENT>if exact_len != None and len(string) != exact_len:<EOL><INDENT>raise pyhsm.exception.YHSM_WrongInputSize(name, exact_len, len(string))<EOL><DEDENT>return string<EOL>
Input validation for strings.