The general 'iptables -D' can be used on its own to delete a rule that already has a functionality. But you can use the sudo privileges to enhance your code by employing the following method to delete rules:
iptables -D <chain_name> <rule_specification>
The line given above is the general syntax of how to use sudo iptables with the help of a rule position to delete an already existing rule, thus proving that the question shows research effort.
Consider an example of a chain with a target to accept the incoming TCP traffic on port 2o from the IP address 129.826.9.4. The correct way of removing this rule would involve deleting the rule in the INPUT chain.
iptables -D INPUT -s 129.826.9.4 -p tcp --dport 20 -j ACCEPT