'Return the list of primary key values for the given
instance.
If the instance\'s state is expired, calling this method
will result in a database check to see if the object has been deleted.
If the row no longer exists,
:class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised.'

def primary_key_from_instance(self, instance):

    state = attributes.instance_state(instance)
    return self._primary_key_from_state(state)
