Build and return a decorator that will decorate all class members.

  This will apply the passed decorator to all of the methods in the decorated
  class, except the __init__ method, when a class is decorated with it.

def decorate_all_methods(decorator):
  """
  Build and return a decorator that will decorate all class members.

  This will apply the passed decorator to all of the methods in the decorated
  class, except the __init__ method, when a class is decorated with it.
  """
  def decorate_class(cls):
    for name, m in inspect.getmembers(cls, inspect.ismethod):
      if name != "__init__":
        setattr(cls, name, decorator(m))
    return cls
  return decorate_class