code: def dbg(message, *args):
      
      if debug_function and enable_notice:
          frm = inspect.stack()[1]
          mod = inspect.getmodule(frm[0])
          if not (mod.__name__ in ignored_modules):
              i = ' ' * _debug_indent
              debug_function(NOTICE, i + 'dbg: ' + message % args)
docs: Looks at the stack, to see if a debug message should be printed.