<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def qmark(cls, query):
 """ Convert a "qmark" query into "format" style. """


        def sub_sequence(m):
            s = m.group(0)
            if s == "??":
                return "?"
            if s == "%":
                return "%%"
            else:
                return "%s"

        return cls.RE_QMARK.sub(sub_sequence, query)