#NEWLINE# def count_calls( fn ) : #NEWLINE# #INDENT# '\n    Decorator to track the number of times a function is called.\n\n    :param fn: the function to be decorated\n    :type fn: C{func}\n\n    :return: the decorated function\n    :rtype: C{func}\n    ' #NEWLINE# @ functools . wraps ( fn ) #NEWLINE# def wrapper( * args , **kwargs ) : #NEWLINE# #INDENT# counter ( ( '%s_calls' % get_qualname ( fn ) ) ) . inc ( ) #NEWLINE# return fn ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return fn