'Escape the string.  Works like :func:`escape` with the difference
that for subclasses of :class:`Markup` this function would return the
correct subclass.'

@classmethod
def escape(cls, s):

    rv = escape(s)
    if (rv.__class__ is not cls):
        return cls(rv)
    return rv
