def unlinked_node_from_data(self, ancestors: list, data) -> UnlinkedNode:
     if len(ancestors
            ) == 0:  # A tier zero search is returning an agency dictionary
         return UnlinkedNode(id=data, ancestors=ancestors, description="")
     else:
         return UnlinkedNode(id=data["id"],
                             ancestors=ancestors,
                             description=data["description"])
 def unlinked_node_from_data(self, ancestors: list, data) -> UnlinkedNode:
     if len(ancestors
            ) == 0:  # A tier zero search is returning an agency dictionary
         return self._generate_agency_node(ancestors, data)
     if len(
             ancestors
     ) == 1:  # A tier one search is returning a FederalAccount object
         return self._generate_federal_account_node(ancestors, data)
     if len(
             ancestors
     ) == 2:  # A tier two search will be returning a TreasuryAppropriationAccount object
         return UnlinkedNode(id=data.tas_rendering_label,
                             ancestors=ancestors,
                             description=data.account_title)
 def _generate_federal_account_node(self, ancestors, data):
     return UnlinkedNode(id=data.federal_account_code,
                         ancestors=ancestors,
                         description=data.account_title)
 def _generate_agency_node(self, ancestors, data):
     return UnlinkedNode(
         id=data["toptier_code"],
         ancestors=ancestors,
         description=f"{data['name']} ({data['abbreviation']})")