def __deserialize_primitive(self, data, klass):
try:<EOL><INDENT>value = klass(data)<EOL><DEDENT>except UnicodeEncodeError:<EOL><INDENT>value = unicode(data)<EOL><DEDENT>except TypeError:<EOL><INDENT>value = data<EOL><DEDENT>return value<EOL>
Deserializes string to primitive type.

:param data: str.
:param klass: class literal.

:return: int, float, str, bool.