def generate()

in resdb_driver/transaction.py [0:0]


    def generate(cls, public_keys, amount):
        """! Generates a Output from a specifically formed tuple or list.
        Note:
            If a ThresholdCondition has to be generated where the threshold
            is always the number of subconditions it is split between, a
            list of the following structure is sufficient:
            [(address|condition)*, [(address|condition)*, ...], ...]

        @param public_keys (:obj:`list` of :obj:`str`): The public key of
            the users that should be able to fulfill the Condition
            that is being created.
        @param amount (:obj:`int`): The amount locked by the Output.
        @return An Output that can be used in a Transaction.

        @exception TypeError: If `public_keys` is not an instance of `list`.
        @exception ValueError: If `public_keys` is an empty list.
        """
        threshold = len(public_keys)
        if not isinstance(amount, int):
            raise TypeError("`amount` must be a int")
        if amount < 1:
            raise AmountError("`amount` needs to be greater than zero")
        if not isinstance(public_keys, list):
            raise TypeError("`public_keys` must be an instance of list")
        if len(public_keys) == 0:
            raise ValueError(
                "`public_keys` needs to contain at least one" "owner")
        elif len(public_keys) == 1 and not isinstance(public_keys[0], list):
            if isinstance(public_keys[0], Fulfillment):
                ffill = public_keys[0]
            else:
                ffill = Ed25519Sha256(
                    public_key=base58.b58decode(public_keys[0]))
            return cls(ffill, public_keys, amount=amount)
        else:
            # Threshold conditions not supported by resdb yet
            initial_cond = ThresholdSha256(threshold=threshold)
            threshold_cond = reduce(
                cls._gen_condition, public_keys, initial_cond)
            return cls(threshold_cond, public_keys, amount=amount)