def getInstanceState(inst, jellier):
    """
    Utility method to default to 'normal' state rules in serialization.
    """
    if hasattr(inst, "__getstate__"):
        state = inst.__getstate__()
    else:
        state = inst.__dict__
    sxp = jellier.prepare(inst)
    sxp.extend([qual(inst.__class__).encode('utf-8'), jellier.jelly(state)])
    return jellier.preserve(inst, sxp)

    Utility method to default to 'normal' state rules in serialization.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/jelly.py