Converts this action to a function or method.
          An optional docstring may be passed.

def as_method(self, docstring=""):
        """
        Converts this action to a function or method.
          An optional docstring may be passed.
        """
        method = lambda obj, *args, **kwargs: self(obj, *args, **kwargs)
        if docstring:
            method.__doc__ = docstring
        return method