<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_nic(client, target, nic):
 """Return a NIC spec"""

    # Iterate through the networks and look for one matching
    # the requested name
    for network in target.network:
        if network.name == nic["network_name"]:
            net = network
            break
    else:
        return None

    # Success! Create a nic attached to this network
    backing = client.create("VirtualEthernetCardNetworkBackingInfo")
    backing.deviceName = nic["network_name"]
    backing.network = net

    connect_info = client.create("VirtualDeviceConnectInfo")
    connect_info.allowGuestControl = True
    connect_info.connected = False
    connect_info.startConnected = True

    new_nic = client.create(nic["type"]) 
    new_nic.backing = backing
    new_nic.key = 2
    # TODO: Work out a way to automatically increment this
    new_nic.unitNumber = 1
    new_nic.addressType = "generated"
    new_nic.connectable = connect_info

    nic_spec = client.create("VirtualDeviceConfigSpec")
    nic_spec.device = new_nic
    nic_spec.fileOperation = None
    operation = client.create("VirtualDeviceConfigSpecOperation")
    nic_spec.operation = (operation.add)

    return nic_spec