'This method defines how the input expression has to be escaped
to perform the injection depending on the injection type
identified as valid'

def prefixQuery(self, expression, prefix=None, where=None, clause=None):

    if conf.direct:
        return self.payloadDirect(expression)
    if (expression is None):
        return None
    expression = self.cleanupPayload(expression)
    expression = unescaper.escape(expression)
    query = None
    if ((where is None) and kb.technique and (kb.technique in kb.injection.data)):
        where = kb.injection.data[kb.technique].where
    if (where == PAYLOAD.WHERE.REPLACE):
        query = ''
    elif (kb.technique == PAYLOAD.TECHNIQUE.STACKED):
        query = kb.injection.prefix
    elif ((kb.injection.clause == [2, 3]) or (kb.injection.clause == [2]) or (kb.injection.clause == [3])):
        query = kb.injection.prefix
    elif ((clause == [2, 3]) or (clause == [2]) or (clause == [3])):
        query = prefix
    else:
        query = (kb.injection.prefix or prefix or '')
        if ((not (expression and (expression[0] == ';'))) and (not (query and (query[(-1)] in ('(', ')')) and expression and (expression[0] in ('(', ')')))) and (not (query and (query[(-1)] == '(')))):
            query += '    '
    query = ('%s%s' % ((query or '').replace('\\', BOUNDARY_BACKSLASH_MARKER), expression))
    return query
