def api_endpoint(path_or_func=None, decorate=True):
    def maybe_decorated(func):
        """Apply API_ENDPOINT_DECORATORS to func."""
        if decorate:
            for decorator in API_ENDPOINT_DECORATORS:
                func = decorator()(func)
        return func
    if callable(path_or_func):
        path_or_func.api_path = path_or_func.__name__
        return maybe_decorated(path_or_func)
    else:
        def _api_endpoint(func):
            """Decorator inner."""
            if path_or_func is None:
                func.api_path = func.__name__
            else:
                func.api_path = path_or_func
            return maybe_decorated(func)
        return _api_endpoint
Tests the expire mechanism.
dataset/ETHPy150Open django-ddp/django-ddp/dddp/api.py/api_endpoint--crossover with--dataset/ETHPy150Open google/grr/grr/lib/utils_test.py/StoreTests.test03Expire