'If a format call is detected, then this is routed through this
method so that our safety sandbox can be used for it.'

def format_string(self, s, args, kwargs):

    if isinstance(s, Markup):
        formatter = SandboxedEscapeFormatter(self, s.escape)
    else:
        formatter = SandboxedFormatter(self)
    kwargs = _MagicFormatMapping(args, kwargs)
    rv = formatter.vformat(s, args, kwargs)
    return type(s)(rv)
