'Decorator adding a subclass of Rewrite to the registry for
the given *kind*.'

def register(self, kind):

    if (kind not in self._kinds):
        raise KeyError(('invalid    kind    %r' % (kind,)))
    def do_register(rewrite_cls):
        if (not issubclass(rewrite_cls, Rewrite)):
            raise TypeError('{0}    is    not    a    subclass    of    Rewrite'.format(rewrite_cls))
        self.rewrites[kind].append(rewrite_cls)
        return rewrite_cls
    return do_register
