docstr: Record the fact that we will want to trace method_name in class cls.
  
  Optionally provide two functions that will execute prior to and after the method. The functions also have a
  chance to modify the input arguments and the return values of the methods.
docstr_tok: ["Record","the","fact","that","we","will","want","to","trace","method_name","in","class","cls",".","Optionally","provide","two","functions","that","will","execute","prior","to","and","after","the","method",".","The","functions","also","have","a","chance","to","modify","the","input","arguments","and","the","return","values","of","the","methods","."]
code: def add_traced(
      self, cls, method_name, stack_level=1, pre_fn=None, post_fn=None
  ):
      """Record the fact that we will want to trace method_name in class cls.
  
      Optionally provide two functions that will execute prior to and after the method. The functions also have a
      chance to modify the input arguments and the return values of the methods.
  
      """
      self.methods.append(
          (cls, method_name, stack_level, pre_fn, post_fn)
      )
  
file_path: pytorch-lightning/src/lightning/app/utilities/tracer.py
imports: import functools
  import inspect
  import runpy
  import sys
  import time
  from pathlib import Path
  from typing import Any, Optional
label_desc: Use image node_id 2 for calling the Tracer obj's underlying member method code with example usage: obj.add_traced(cls, method_name, stack_level, pre_fn, post_fn) without return types