<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_serial_ports(serial_ports):
    '''
    Returns a list of vim.vm.device.VirtualDeviceSpec objects representing the
    serial ports to be created for a virtual machine

    serial_ports
        Serial port properties
    '''
    ports = []
    keys = range(-9000, -9050, -1)
    if serial_ports:
        devs = [serial['adapter'] for serial in serial_ports]
        log.trace('Creating serial ports %s', devs)
        for port, key in zip(serial_ports, keys):
            serial_port_device = _apply_serial_port(port, key, 'add')
            ports.append(serial_port_device)
    return ports