def sweep_htlctx_output(
        *, htlc_tx: Transaction,
        output_idx: int,
        htlctx_witness_script: bytes,
        privkey: bytes,
        is_revocation: bool,
        to_self_delay: int = None,
) -> Optional[PartialTxInput]:
    """Create a txn that sweeps the output of a first stage htlc tx
    (i.e. sweeps from an HTLC-Timeout or an HTLC-Success tx).
    """
    # note: this is the same as sweeping the to_local output of the ctx,
    #       as these are the same script (address-reuse).
    return sweep_ctx_to_local(
        ctx=htlc_tx,
        output_idx=output_idx,
        witness_script=htlctx_witness_script,
        privkey=privkey,
        is_revocation=is_revocation,
        to_self_delay=to_self_delay,
    )
Create a txn that sweeps the output of a first stage htlc tx
    (i.e. sweeps from an HTLC-Timeout or an HTLC-Success tx).
    
electrum/lnsweep.py