Check a value or object if the type of it is primitive, or convert it to other primitive type in Python.