def get_functions_with_decorator_defined(code, decorator_name):
    """Get all functions in a code object which have a decorator defined,
    along with the arguments of the function and the decorator.

    Parameters
    ----------

    code : object
      Module or class object from which to retrieve the functions.

    decorator_name : str
      Name of the decorator defined in the functions to search.
    """

    class FunctionsWithDefinedDecoratorExtractor(ast.NodeVisitor):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)

            self.functions_with_decorator = []

        def generic_visit(self, node):
            if isinstance(node, ast.FunctionDef) and node.decorator_list:
                for dec in node.decorator_list:
                    if not isinstance(dec, ast.Call) or dec.func.id != decorator_name:
                        continue

                    decorator_argument_names = []
                    if isinstance(dec.args, ast.List):
                        for args in dec.args:
                            decorator_argument_names.extend(
                                [e.value for e in args.elts]
                            )
                    else:
                        for args in dec.args:
                            if isinstance(args, (ast.List, ast.Tuple)):
                                decorator_argument_names.extend(
                                    [e.value for e in args.elts]
                                )
                            else:
                                decorator_argument_names.append(args.value)

                    function_argument_names = [arg.arg for arg in node.args.args]
                    for arg in node.args.kwonlyargs:
                        function_argument_names.append(arg.arg)

                    self.functions_with_decorator.append(
                        {
                            "function_name": node.name,
                            "function_arguments": function_argument_names,
                            "decorator_arguments": decorator_argument_names,
                        }
                    )

            ast.NodeVisitor.generic_visit(self, node)

    modtree = ast.parse(inspect.getsource(code))
    visitor = FunctionsWithDefinedDecoratorExtractor()
    visitor.visit(modtree)
    return visitor.functions_with_decorator
Get all functions in a code object which have a decorator defined,
    along with the arguments of the function and the decorator.

    Parameters
    ----------

    code : object
      Module or class object from which to retrieve the functions.

    decorator_name : str
      Name of the decorator defined in the functions to search.
    
tests/conftest.py