need help deciphering what an IRULE is doing

We have an IRULE in use written by someone who no longer works here and I am at a loss for what it does. Could someone please interpret what it is doing ?

when HTTP_REQUEST {
  log local0. "MET: entered rule [HTTP::uri]";
  switch -glob [HTTP::uri] {  
    "/exporttable*" {
      set csv "Table,Key,Value\n";
      set tname [getfield [HTTP::uri] "/" 3]
      log local0. "MET: exporttable $tname";
      foreach key [table keys -subtable $tname] {
        log local0. "MEET: $key"
        set val [table lookup -subtable $tname $key];
        append csv "$tname,$key,$val\n";
      }
      set filename [clock format [clock seconds] -format "%Y%m%d_%H%M%S_${tname}.csv"]
      HTTP::respond 200 Content $csv \
      "Content-Type" "text/csv" \
      "Content-Disposition" "attachment: filename=${filename}";
    }
  }
}

Hi,

This irule allow you to export entries from a specific table name to a CSV file.

You can download the file using a request to the VS with this kind of URI /exporttable/xxx/tablename

It looks like a debug irule. You may other irules that record values in those tables.