"""This module contains the DFA implementation"""
# !/usr/bin/python
import imp
import copy
try:
    print 'Checking for pywrapfst module:',
    imp.find_module('pywrapfst')
    print 'OK'
    from pywrapfstdfa import PywrapfstDFA, TropicalWeight

    class DFA(PywrapfstDFA):
        """The DFA class implemented using openFst library"""
        def copy(self):
            mma = DFA()
            mma.automaton =self.automaton.copy()
            mma.alphabet = copy.deepcopy(self.alphabet)
            mma.isyms = copy.deepcopy(self.isyms)
            mma.osyms = copy.deepcopy(self.osyms)
            return mma

        pass
except ImportError:
    print 'FAIL'
    try:
        print 'Checking for fst module:',
        imp.find_module('fst')
        print 'OK'
        from fstdfa import FstDFA, TropicalWeight

        class DFA(FstDFA):
            """The DFA class implemented using openFst library"""
            pass

    except ImportError:
        print 'FAIL'
        print 'Fallback to python implementation:OK'
        from pythondfa import PythonDFA, TropicalWeight

        class DFA(PythonDFA):
            """The DFA class implemented using python"""

            def copy(self):
                mma = DFA()
                mma.states = copy.deepcopy(self.states)
                mma.alphabet = copy.deepcopy(self.alphabet)
                mma.isyms = copy.deepcopy(self.isyms)
                mma.osyms = copy.deepcopy(self.osyms)
                return mma
            pass

@@ -86,24 +86,300 @@
 t copy%0Atry:%0A
+    print 'Checking for fst module:',%0A    imp.find_module('fst')%0A    print 'OK'%0A    from fstdfa import FstDFA, TropicalWeight%0A%0A%0A    class DFA(FstDFA):%0A        %22%22%22The DFA class implemented using openFst library%22%22%22%0A        pass%0Aexcept ImportError:%0A    print 'FAIL'%0A    try:%0A    
     print 'C
@@ -406,32 +406,36 @@
 t module:',%0A    
+ 
+   
 imp.find_module(
@@ -443,24 +443,28 @@
 pywrapfst')%0A
+    
     print 'O
@@ -466,24 +466,28 @@
 nt 'OK'%0A    
+   
+ 
 from pywrapf
@@ -525,24 +525,28 @@
 icalWeight%0A%0A
+    
     class DF
@@ -562,32 +562,36 @@
 stDFA):%0A        
+    
 %22%22%22The DFA class
@@ -628,24 +628,25 @@
 rary%22%22%22%0A
+%0A
         
 def copy
@@ -629,32 +629,36 @@
 ary%22%22%22%0A%0A        
+    
 def copy(self):%0A
@@ -661,32 +661,36 @@
 f):%0A            
+    
 mma = DFA()%0A    
@@ -693,24 +693,28 @@
             
+  
+  
 mma.automato
@@ -716,16 +716,17 @@
 omaton =
+ 
 self.aut
@@ -739,16 +739,20 @@
 .copy()%0A
+    
         
@@ -803,32 +803,36 @@
 et)%0A            
+  
+  
 mma.isyms = copy
@@ -845,32 +845,36 @@
 opy(self.isyms)%0A
+    
             mma.
@@ -911,32 +911,36 @@
 ms)%0A            
+    
 return mma%0A%0A    
@@ -937,321 +937,8 @@
  mma
-%0A%0A        pass%0Aexcept ImportError:%0A    print 'FAIL'%0A    try:%0A        print 'Checking for fst module:',%0A        imp.find_module('fst')%0A        print 'OK'%0A        from fstdfa import FstDFA, TropicalWeight%0A%0A        class DFA(FstDFA):%0A            %22%22%22The DFA class implemented using openFst library%22%22%22%0A            pass
 %0A%0A  

change DFA priority