code: def btc_tx_witness_strip( tx_serialized ):
      
      if not btc_tx_is_segwit(tx_serialized):
          # already strippped
          return tx_serialized
       
      tx = btc_tx_deserialize(tx_serialized)
      for inp in tx['ins']:
          del inp['witness_script']
  
      tx_stripped = btc_tx_serialize(tx)
      return tx_stripped
docs: Strip the witness information from a serialized transaction