'Replaces payload inside the input string with a given payload'

def replacePayload(self, value, payload):

    _ = re.escape(PAYLOAD_DELIMITER)
    return (re.sub(('(?s)(%s.*?%s)' % (_, _)), ('%s%s%s' % (PAYLOAD_DELIMITER, getUnicode(payload), PAYLOAD_DELIMITER)).replace('\\', '\\\\'), value) if value else value)
