code: def list(gandi, domain, zone_id, output, format, limit):
      
      options = {
          'items_per_page': limit,
      }
      output_keys = ['name', 'type', 'value', 'ttl']
  
      if not zone_id:
          result = gandi.domain.info(domain)
          zone_id = result['zone_id']
  
      if not zone_id:
          gandi.echo('No zone records found, domain %s doesn\'t seems to be '
                     'managed at Gandi.' % domain)
          return
  
      records = gandi.record.list(zone_id, options)
  
      if not output and not format:
          for num, rec in enumerate(records):
              if num:
                  gandi.separator_line()
              output_generic(gandi, rec, output_keys, justify=12)
      elif output:
          zone_filename = domain + "_" + str(zone_id)
          if os.path.isfile(zone_filename):
              open(zone_filename, 'w').close()
          for record in records:
              format_record = ('%s %s IN %s %s' %
                               (record['name'], record['ttl'],
                                record['type'], record['value']))
              with open(zone_filename, 'ab') as zone_file:
                  zone_file.write(format_record + '\n')
          gandi.echo('Your zone file have been writen in %s' % zone_filename)
      elif format:
          if format == 'text':
              for record in records:
                  format_record = ('%s %s IN %s %s' %
                                   (record['name'], record['ttl'],
                                    record['type'], record['value']))
                  gandi.echo(format_record)
          if format == 'json':
              format_record = json.dumps(records, sort_keys=True,
                                         indent=4, separators=(',', ': '))
              gandi.echo(format_record)
  
      return records
docs: List DNS zone records for a domain.