Decorator to debug the given method

def debug(method):
    """Decorator to debug the given method"""
    def new_method(*args, **kwargs):
        import pdb
        try:
            import pudb
        except ImportError:
            pudb = pdb
        try:
            pudb.runcall(method, *args, **kwargs)
        except pdb.bdb.BdbQuit:
            sys.exit('Normal quit from debugger')
    new_method.__doc__ = method.__doc__
    new_method.__name__ = 'debug(%s)' % method.__name__
    return new_method