def transfer(self, asset_transfer_specs, btc_transfer_spec, fees):
        inputs = []
        outputs = []
        asset_quantities = []
        for asset_id, transfer_spec in asset_transfer_specs:
            colored_outputs, collected_amount = self._collect_colored_outputs(
                transfer_spec.unspent_outputs, asset_id, transfer_spec.amount)
            inputs.extend(colored_outputs)
            outputs.append(self._get_colored_output(transfer_spec.to_script))
            asset_quantities.append(transfer_spec.amount)

            if collected_amount > transfer_spec.amount:
                outputs.append(self._get_colored_output(transfer_spec.change_script))
                asset_quantities.append(collected_amount - transfer_spec.amount)

        btc_excess = sum([input.output.value for input in inputs]) - sum([output.nValue for output in outputs])

        if btc_excess < btc_transfer_spec.amount + fees:
            # Not enough bitcoin inputs
            uncolored_outputs, total_amount = self._collect_uncolored_outputs(
                btc_transfer_spec.unspent_outputs, btc_transfer_spec.amount + fees - btc_excess)
            inputs.extend(uncolored_outputs)
            btc_excess += total_amount

        change = btc_excess - btc_transfer_spec.amount - fees
        if change > 0:
            # Too much bitcoin in input, send it back as change
            outputs.append(self._get_uncolored_output(btc_transfer_spec.change_script, change))

        if btc_transfer_spec.amount > 0:
            outputs.append(self._get_uncolored_output(btc_transfer_spec.to_script, btc_transfer_spec.amount))

        if asset_quantities:
            outputs.insert(0, self._get_marker_output(asset_quantities, b''))

        return bitcoin.core.CTransaction(
            vin=[bitcoin.core.CTxIn(item.out_point, item.output.script) for item in inputs],
            vout=outputs
        )
L{ClientCreator.connectTCP} inserts a very short delayed call between
dataset/ETHPy150Open OpenAssets/openassets/openassets/transactions.py/TransactionBuilder.transfer--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_protocol.py/ClientCreatorTests.test_cancelConnectTCPTimeout