def METHOD_NAME(self, root, current_code):
    if root == None:
        return
    if root.char != None:
        self.codes[root.char] = current_code
        self.reverse_mapping[current_code] = root.char
        return
    self.METHOD_NAME(root.left, current_code + "0")
    self.METHOD_NAME(root.right, current_code + "1")