'Signs a ThresholdSha256.
Args:
input_ (:class:`~bigchaindb.common.transaction.
Input`) The Input to be signed.
message (str): The message to be signed
key_pairs (dict): The keys to sign the Transaction with.'

@classmethod
def _sign_threshold_signature_fulfillment(cls, input_, message, key_pairs):

    input_ = deepcopy(input_)
    for owner_before in set(input_.owners_before):
        ccffill = input_.fulfillment
        subffills = ccffill.get_subcondition_from_vk(base58.b58decode(owner_before))
        if (not subffills):
            raise KeypairMismatchException('Public    key    {}    cannot    be    found    in    the    fulfillment'.format(owner_before))
        try:
            private_key = key_pairs[owner_before]
        except KeyError:
            raise KeypairMismatchException('Public    key    {}    is    not    a    pair    to    any    of    the    private    keys'.format(owner_before))
        for subffill in subffills:
            subffill.sign(message.encode(), base58.b58decode(private_key.encode()))
    return input_
