fix this code - import concurrent.futures
import nmap
import os
import shutil

# Set up the input and output files
ips_file = 'ips.txt'
completed_ips_file = 'completed_ips.txt'
pending_ips_file = 'pending_ips.txt'

# Set up the nmap options
nmap_options = ['Pn', 'n', 'sC', 'sV', 'p-', '-min-rate 300', '-max-rate 500']

# Set up the concurrent futures
max_workers = 5
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
    # Read the IP addresses from the file
    with open(ips_file, 'r') as f:
        ips = f.read().splitlines()

    # Process the IP addresses in parallel
    futures = []
    for ip in ips:
        futures.append(executor.submit(nmap_scan, ip))

    # Wait for all the futures to complete
    for future in concurrent.futures.as_completed(futures):
        ip = future.result()
        # Add the IP address to the completed file
        with open(completed_ips_file, 'a') as f:
            f.write(ip + '\n')
        # Remove the IP address from the pending file
        with open(pending_ips_file, 'w') as f:
            f.write(''.join(ips))

def nmap_scan(ip):
    # Perform the nmap scan
    nmap_output = nmap.port_scan(hosts=ip, arguments=nmap_options)

    # Save the output to a file
    output_folder = os.path.join('output', ip)
    os.makedirs(output_folder, exist_ok=True)
    with open(os.path.join(output_folder, 'nmap-output'), 'w') as f:
        f.write(nmap_output)

    return ip Your answer should have exactly 7 paragraphs. Make sure that the 3rd paragraph starts with the word "steps" and that each paragraph is separated by two new lines.
user