code: def _remove_unused_wires(block, keep_inputs=True):
      
      valid_wires = set()
      for logic_net in block.logic:
          valid_wires.update(logic_net.args, logic_net.dests)
  
      wire_removal_set = block.wirevector_set.difference(valid_wires)
      for removed_wire in wire_removal_set:
          if isinstance(removed_wire, Input):
              term = " optimized away"
              if keep_inputs:
                  valid_wires.add(removed_wire)
                  term = " deemed useless by optimization"
  
              print("Input Wire, " + removed_wire.name + " has been" + term)
          if isinstance(removed_wire, Output):
              PyrtlInternalError("Output wire, " + removed_wire.name + " not driven")
  
      block.wirevector_set = valid_wires
docs: Removes all unconnected wires from a block