human
Complete this python program:
def _NeedsIndexes(func):
assistant
#Here is the Python program you requested.

    """A decorator for DatastoreStub methods that require or affect indexes.
    Updates indexes to match index.yaml before the call and updates index.yaml
    after the call if require_indexes is False. If root_path is not set, this is a
    no op.
    """
    def UpdateIndexesWrapper(self, *args, **kwargs):
        self._SetupIndexes()
        try:
            return func(self, *args, **kwargs)
        finally:
            self._UpdateIndexes()
    return UpdateIndexesWrapper