def set_state(self, updater=None, **kwargs):
        """Update the datastore.

        :param func|dict updater: (state) => state_change or dict state_change
        :rtype: Iterable[tornado.concurrent.Future]
        """
        if callable(updater):
            state_change = updater(self)
        elif updater is not None:
            state_change = updater
        else:
            state_change = kwargs

        return [callback_result
                for k, v in state_change.items()
                for callback_result in self.set(k, v)]
def set_state ( self , updater = None , ** kwargs ) : if callable ( updater ) : state_change = updater ( self ) elif updater is not None : state_change = updater else : state_change = kwargs return [ callback_result for k , v in state_change . items ( ) for callback_result in self . set ( k , v ) ]
Update the datastore.

        :param func|dict updater: (state) => state_change or dict state_change
        :rtype: Iterable[tornado.concurrent.Future]