code: def build_fptree(self, transactions, root_value,
                       root_count, frequent, headers):
          
          root = FPNode(root_value, root_count, None)
  
          for transaction in transactions:
              sorted_items = [x for x in transaction if x in frequent]
              sorted_items.sort(key=lambda x: frequent[x], reverse=True)
              if len(sorted_items) > 0:
                  self.insert_tree(sorted_items, root, headers)
  
          return root
docs: Build the FP tree and return the root node.