ENDS_HERE = '#'

class Trie:
    
    def __init__(self):
        self._trie = {}

    def insert(self,text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True
    
    def find(self,prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie

if __name__ == "__main__":
    trie = Trie()
    trie.insert("coat")
    #print(trie._trie)
    trie.find("c")
1d35a6fca5c2ee63a50debe9da8efa1187742872
<mask token>


class Trie:
    <mask token>

    def insert(self, text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True

    def find(self, prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie


<mask token>

<mask token>


class Trie:

    def __init__(self):
        self._trie = {}

    def insert(self, text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True

    def find(self, prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie


<mask token>

<mask token>


class Trie:

    def __init__(self):
        self._trie = {}

    def insert(self, text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True

    def find(self, prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie


if __name__ == '__main__':
    trie = Trie()
    trie.insert('coat')
    trie.find('c')

ENDS_HERE = '#'


class Trie:

    def __init__(self):
        self._trie = {}

    def insert(self, text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True

    def find(self, prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie


if __name__ == '__main__':
    trie = Trie()
    trie.insert('coat')
    trie.find('c')

ENDS_HERE = '#'

class Trie:
    
    def __init__(self):
        self._trie = {}

    def insert(self,text):
        trie = self._trie
        for char in text:
            if char not in trie:
                trie[char] = {}
            trie = trie[char]
        trie[ENDS_HERE] = True
    
    def find(self,prefix):
        trie = self._trie
        for char in prefix:
            if char in trie:
                trie = trie[char]
            else:
                return None
        return trie

if __name__ == "__main__":
    trie = Trie()
    trie.insert("coat")
    #print(trie._trie)
    trie.find("c")