code: def update(gandi, resource, name, gateway, create, bandwidth):
      
      params = {}
      if name:
          params['name'] = name
  
      vlan_id = gandi.vlan.usable_id(resource)
  
      try:
          if gateway:
              IP(gateway)
              params['gateway'] = gateway
      except ValueError:
          vm = gandi.iaas.info(gateway)
          ips = [ip for sublist in
                 [[ip['ip'] for ip in iface['ips'] if ip['version'] == 4]
                  for iface in vm['ifaces']
                  if iface['vlan'] and iface['vlan'].get('id') == vlan_id]
                 for ip in sublist]
  
          if len(ips) > 1:
              gandi.echo("This vm has two ips in the vlan, don't know which one"
                         ' to choose (%s)' % (', '.join(ips)))
              return
  
          if not ips and not create:
              gandi.echo("Can't find '%s' in '%s' vlan" % (gateway, resource))
              return
  
          if not ips and create:
              gandi.echo('Will create a new ip in this vlan for vm %s' % gateway)
              oper = gandi.ip.create('4', vm['datacenter_id'], bandwidth,
                                     vm['hostname'], resource)
  
              iface_id = oper['iface_id']
              iface = gandi.iface.info(iface_id)
              ips = [ip['ip'] for ip in iface['ips'] if ip['version'] == 4]
  
          params['gateway'] = ips[0]
  
      result = gandi.vlan.update(resource, params)
  
      return result
docs: Update a vlan
  
      ``gateway`` can be a vm name or id, or an ip.