class PyStringObject(Structure):
    _fields_ = [('ob_refcnt', c_ssize_t), ('ob_type', py_object), (
        'ob_size', c_ssize_t), ('ob_shash', c_long), ('ob_sstate', c_int)]

def zerostr(s):
    """zero a non-interned string"""
if not isinstance(s, str):
    raise TypeError('expected str object, not %s' % type(s).__name__)
s_obj = PyStringObject.from_address(id(s))
if s_obj.ob_sstate > 0:
    raise RuntimeError('cannot zero interned string')
ctypes in python crashes with memset