<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list(gandi, datacenter, id, subnet, gateway):
 """List vlans."""

    output_keys = ['name', 'state', 'dc']
    if id:
        output_keys.append('id')
    if subnet:
        output_keys.append('subnet')
    if gateway:
        output_keys.append('gateway')

    datacenters = gandi.datacenter.list()

    vlans = gandi.vlan.list(datacenter)
    for num, vlan in enumerate(vlans):
        if num:
            gandi.separator_line()
        output_vlan(gandi, vlan, datacenters, output_keys)

    return vlans