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

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

:return: int, long, float, str, bool.