code: def httprettified(test):
      "A decorator tests that use HTTPretty"
      def decorate_class(klass):
          for attr in dir(klass):
              if not attr.startswith('test_'):
                  continue
  
              attr_value = getattr(klass, attr)
              if not hasattr(attr_value, "__call__"):
                  continue
  
              setattr(klass, attr, decorate_callable(attr_value))
          return klass
  
      def decorate_callable(test):
          @functools.wraps(test)
          def wrapper(*args, **kw):
              httpretty.reset()
              httpretty.enable()
              try:
                  return test(*args, **kw)
              finally:
                  httpretty.disable()
          return wrapper
  
      if isinstance(test, ClassTypes):
          return decorate_class(test)
      return decorate_callable(testf httprettified(test):
      "A decorator tests that use HTTPretty"
      def decorate_class(klass):
          for attr in dir(klass):
              if not attr.startswith('test_'):
                  continue
  
              attr_value = getattr(klass, attr)
              if not hasattr(attr_value, "__call__"):
                  continue
  
              setattr(klass, attr, decorate_callable(attr_value))
          return klass
  
      def decorate_callable(test):
          @functools.wraps(test)
          def wrapper(*args, **kw):
              httpretty.reset()
              httpretty.enable()
              try:
                  return test(*args, **kw)
              finally:
                  httpretty.disable()
          return wrapper
  
      if isinstance(test, ClassTypes):
          return decorate_class(test)
      return decorate_callable(test)
docs: A decorator tests that use HTTPretty