<%!
def column_width(column, table):
    return max(map(lambda row: len(row[column]), table)) if table else 0
%>\
$TTL 600
@   IN  SOA        ns.sublimity.de. admin.sublimity.de. (
        2020080302 ;Serial
        1200       ;Refresh
        600        ;Retry
        1209600    ;Expire
        600        ;Negative response caching TTL
)

% for record in sorted(records, key=lambda r: (r['name'], r['type'], r['value'])):
  % for part in (record['value'][i:i+255] for i in range(0, len(record['value']), 255)):
${record['name'].ljust(column_width('name', records))} \
IN \
${record['type'].ljust(column_width('type', records))} \
    % if record['type'] == 'TXT':
      "${part}"
    % else:
      ${part}
    % endif
  % endfor
% endfor