<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def action(atomic=None, **kwargs):
 """ Mark a method as an action. """

    def decorator(func):
        if atomic is None:
            _atomic = getattr(settings, 'ATOMIC_REQUESTS', False)
        else:
            _atomic = atomic

        func.action = True
        func.kwargs = kwargs
        if asyncio.iscoroutinefunction(func):
            if _atomic:
                raise ValueError('Only synchronous actions can be atomic')
            return func

        if _atomic:
            # wrap function in atomic wrapper
            func = transaction.atomic(func)

        @wraps(func)
        async def async_f(self: AsyncAPIConsumer,
                          *args, **_kwargs):

            result, status = await database_sync_to_async(func)(
                self, *args, **_kwargs
            )

            return result, status

        async_f.action = True
        async_f.kwargs = kwargs
        async_f.__name__ = func.__name__

        return async_f

    return decorator