def taproot_output_script(internal_pubkey: bytes, *, script_tree: Optional[TapTree]) -> bytes:
    """Given an internal public key and a tree of scripts, compute the output script."""
    assert isinstance(internal_pubkey, bytes), type(internal_pubkey)
    assert len(internal_pubkey) == 32, len(internal_pubkey)
    if script_tree is None:
        merkle_root = bytes()
    else:
        _, merkle_root = taproot_tree_helper(script_tree)
    _, output_pubkey = taproot_tweak_pubkey(internal_pubkey, merkle_root)
    return construct_script([1, output_pubkey])
Given an internal public key and a tree of scripts, compute the output script.
electrum/bitcoin.py