def topological_sort(self):
        result = []
        # Make a shallow copy of the adjacency list
        alist = {}
        for k, v in self.adjacency_list.items():
            alist[k] = v[:]
        while True:
            # See what we can remove in this run
            to_remove = []
            for k, v in list(alist.items())[:]:
                if not v:
                    to_remove.append(k)
                    del alist[k]
            if not to_remove:
                # What's left in alist (if anything) is a cycle.
                break
            # Remove from the adjacency list of others
            for k, v in alist.items():
                alist[k] = [(d, r) for d, r in v if d not in to_remove]
            logger.debug('Moving to result: %s',
                         ['%s (%s)' % (d.name, d.version) for d in to_remove])
            result.extend(to_remove)
        return result, list(alist.keys())
same as create, takes CustomerDetails.RebillCustomerID
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/distlib/database.py/DependencyGraph.topological_sort--crossover with--dataset/ETHPy150Open agiliq/merchant/billing/gateways/eway_gateway/eway_api/client.py/RebillEwayClient.update_rebill_customer