docs: def action(forwards=None, context_class=None):
      """
      Decorator to build functions.
  
      This decorator can be applied to a function to build actions. The
      decorated function becomes the ``forwards`` implementation of the action.
      The first argument of the ``forwards`` implementation is a context object
      that can be used to share state between the forwards and backwards
      implementations. This argument is passed implicitly by ``reversible`` and
      callers of the function shouldn't provide it.
  
      .. code-block:: python
  
          @reversible.action
          def create_order(context, order_details):
              order_id = OrderStore.put(order_details)
              context['order_id'] = order_id
              return order_id
  
      The ``.backwards`` attribute of the decorated function can itself be used
      as a decorator to specify the ``backwards`` implementation of the action.
  
      .. code-block:: python
  
          @create_order.backwards
          def delete_order(context, order_details):
              if 'order_id' in context:
                  # order_id will be absent if create_order failed
                  OrderStore.delete(context['order_id'])
  
          # Note that the context argument was not provided here. It's added
          # implicitly by the library.
          action = create_order(order_details)
          order_id = reversible.execute(action)
  
      Both, the ``forwards`` and ``backwards`` implementations will be called
      with the same arguments. Any information that needs to be sent from
      ``forwards`` to ``backwards`` must be added to the context object.
  
      The context object defaults to a dictionary. An alternative context
      constructor may be provided using the ``context_class`` argument. It will
      be called with no arguments to construct the context object.
  
      .. code-block:: python
  
          @reversible.action(context_class=UserInfo)
          def create_user(user_info, user_details):
              user_info.user_id = UserStore.put(user_details)
              return user_info
  
      Note that a backwards action is required. Attempts to use the action
      without specifying a way to roll back will fail.
  
      :param forwards:
          The function will be treated as the ``forwards`` implementation.
      :param context_class:
          Constructor for context objects. A single action call will have its
          own context object and that object will be implictly passed as the
          first argument to both, the ``forwards`` and the ``backwards``
          implementations.
      :returns:
          If ``forwards`` was given, a partially constructed action is returned.
          The ``backwards`` method on that object can be used as a decorator to
          specify the rollback method for the action. If ``forwards`` was
          omitted, a decorator that accepts the ``forwards`` method is returned.
      """
      context_class = context_class or dict
  
      def decorator(_forwards):
          return ActionBuilder(_forwards, context_class)
  
      if forwards is not None:
          return decorator(forwards)
      else:
          return decorator