def abstract(cls):
  """
  Creates an __init__ method for the given class that raises a
  NotImplementedError indicating that the class is abstract. Classes inheriting
  from an abstract base class that don't override __init__ will also be
  effectively abstract.
  """
  def __init__(self):
    raise NotImplementedError(
      "Can't instantiate abstract class '{}'.".format(
        type(self).__name__
      )
    )
  cls.__init__ = __init__
  return cls