'Install a default InstanceState if none is present.
A private convenience method used by the __init__ decorator.'

def _new_state_if_none(self, instance):

    if hasattr(instance, self.STATE_ATTR):
        return False
    elif ((self.class_ is not instance.__class__) and self.is_mapped):
        return self._subclass_manager(instance.__class__)._new_state_if_none(instance)
    else:
        state = self._state_constructor(instance, self)
        setattr(instance, self.STATE_ATTR, state)
        return state
