kora 2 years ago
parent
commit
037c38ef51
4 changed files with 1 additions and 4268 deletions
  1. 1 1
      .gitignore
  2. 0 2133
      tempWork/.ipynb_checkpoints/EAD_to_CSV_datini.ipynb
  3. 0 2133
      tempWork/EAD_to_CSV_datini.ipynb
  4. 0 1
      tempWork/Readme.txt

+ 1 - 1
.gitignore

@@ -1,2 +1,2 @@
  
-Parser/tempWork/
+tempWork/

+ 0 - 2133
tempWork/.ipynb_checkpoints/EAD_to_CSV_datini.ipynb

@@ -1,2133 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# SETUP"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Input\n",
-    "\n",
-    "As a first step, define local parameters affecting the behaviour of the script. There are three:\n",
-    "- *import_dir*: the directory the input xml file is located in\n",
-    "- *input_file*: the full name of the input file\n",
-    "- *export_dir*: the name of the directory the output file(s) will be saved to (must be already existing when the script is run)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 22,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/home/kora/Desktop/OVI_Data_Local/ASPO/XML/'\n",
-    "input_file = 'export_aspoSt001--datini.xml'\n",
-    "export_dir = '/home/kora/Desktop/OVI_Data_Local/ASPO/CSV/Datini/'"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Packages\n",
-    "\n",
-    "For clarity, define here all the **package imports** which are needed to run the script"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# ESSENTIAL IMPORTS\n",
-    "\n",
-    "# The XML parser this work is based on\n",
-    "import xml.etree.ElementTree as ET\n",
-    "# Utilities for reading/writing csv files\n",
-    "import csv\n",
-    "# Utilities to handle character encodings\n",
-    "import unicodedata\n",
-    "# Ordered dicts: the main structure we store data in before exporting to CSV\n",
-    "from collections import OrderedDict\n",
-    "\n",
-    "\n",
-    "# ADDITIONAL (OPTIONAL) IMPORTS\n",
-    "\n",
-    "# Used to make simple performance estimates by recording the time needed to run various sets of commands\n",
-    "from datetime import datetime\n",
-    "# Psuedorandom number generator useful for testing\n",
-    "from random import *\n",
-    "\n",
-    "# Può servire per alcuni test\n",
-    "import sys"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Functions\n",
-    "\n",
-    "Here we define a set of custom functions to extend ElementTree's capabilities\n",
-    "\n",
-    "**ElementTree** has a very efficient built-in function, **iter**, which can be used to search all nodes of an XML tree for specific kinds of data. However, *iter* does not automatically detect the *parent nodes* of the elements it tracks, which is by contrast something we need to be able to do in general.\n",
-    "\n",
-    "For this reason we defined a custom *iter*-like function, **traceElems**, which can be used to do just that.\n",
-    "\n",
-    "*traceElems* parses the nodes on a tree storing info about their parent nodes, returning all those for which the argument function 'condition' returns True. Note that *traceElems* by design **DOES NOT** parse the *child* nodes of those it returns.\n",
-    "\n",
-    "We also define a **translator function** which will parse the output of *traceElems* and save them in an *ordered dict*, suitable for their export in a csv file. **THIS IS THE FUNCTION YOU'LL WANT TO EDIT IN ORDER TO PERSONALISE THE PARSER TO DEAL WITH SPECIFIC EAD DOCUMENTS**, if needed.\n",
-    "\n",
-    "Finally, we define some extra utility functions."
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "**The translator**\n",
-    "\n",
-    "*This is the function you'll want to edit in order to personalise the parser to deal with specific EAD documents*"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Our test case is a collection of the 'Archivio Statale' of Prato, Italy (ASPO); for this reason, some of the information in the xml file and the translator function is in Italian.\n",
-    "\n",
-    "\n",
-    "# Translator function\n",
-    "def translator(elem):\n",
-    "    # Define the output variable\n",
-    "    csvProt = {}\n",
-    "\n",
-    "    # Process the parent nodes of 'elem', recording their tags and attributes\n",
-    "    par_tags = list(map(lambda a: a.tag, elem['a_par']))\n",
-    "    par_attributes = list(map(lambda a: a.attrib, elem['a_par']))\n",
-    "    \n",
-    "    # e0: 'id' attributes of the parent nodes\n",
-    "    for ii in indices(par_tags, 'c'):\n",
-    "        key = 'id_' + par_attributes[ii]['level']\n",
-    "        csvProt[key] = par_attributes[ii]['id']\n",
-    "\n",
-    "    #\n",
-    "    # Process the children nodes of 'elem', stopping at any 'c' sub-tag\n",
-    "    toProc = traceElems(elem['child'], isLeafOrC)\n",
-    "    first = True\n",
-    "    for node in toProc:\n",
-    "        tags = list(map(lambda a: a.tag, node['a_par'])) + [node['child'].tag]\n",
-    "        attributes = list(map(lambda a: a.attrib, node['a_par'])) + [node['child'].attrib]\n",
-    "        content = node['child'].text\n",
-    "\n",
-    "        # Infos to check for the first child only (they'll equal for all children in a well-formed file)\n",
-    "        if(first):\n",
-    "            # e1 'id' attribute of 'elem'\n",
-    "            csvProt['id'] = attributes[tags.index('c')]['id']\n",
-    "            # e2 'audience' attribute of 'elem' (should be either 'external' or 'internal')\n",
-    "            try:\n",
-    "                csvProt['audience'] = attributes[tags.index('c')]['audience']\n",
-    "            except:\n",
-    "                pass\n",
-    "            # e3 Otherlevel\n",
-    "            try:\n",
-    "                csvProt['altro_livello'] = attributes[tags.index('c')]['otherlevel']\n",
-    "            except:\n",
-    "                pass\n",
-    "            first = False\n",
-    "\n",
-    "        # e4 Repository\n",
-    "        if('repository' in tags):\n",
-    "            csvProt['repository'] = content  \n",
-    "\n",
-    "        # e5 Bioghits\n",
-    "        if('bioghist' in tags):\n",
-    "            csvProt['bioghist'] = content    \n",
-    "        # e6 Arrangement\n",
-    "        elif('arrangement' in tags):\n",
-    "            csvProt['arrangement'] = content\n",
-    "        # e7 Related Material\n",
-    "        elif('relatedmaterial' in tags):\n",
-    "            csvProt['relatedmaterial'] = content\n",
-    "        \n",
-    "        # e8 'Tipologia'\n",
-    "        try:\n",
-    "            ii = tags.index('materialspec')\n",
-    "            if(attributes[ii]['label']=='tipologia'):\n",
-    "                csvProt['tipologia'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e9a 'Segnatura' of 'buste' and 'registri' in ASPO's 'Datini' collection\n",
-    "        try:\n",
-    "            ii = tags.index('container')\n",
-    "            type1 = attributes[ii]['type']\n",
-    "            if(type1.find('numero un')>=0):\n",
-    "                csvProt['segnatura_registri_1'] = content\n",
-    "            elif(type1.find('numero sott')>=0):\n",
-    "                csvProt['segnatura_registri_2'] = content\n",
-    "            elif(type1=='busta'):\n",
-    "                csvProt['segnatura_busta'] = content\n",
-    "            elif(type1=='inserto'):\n",
-    "                csvProt['segnatura_inserto'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        # e9b 'Segnatura codice'\n",
-    "        try:\n",
-    "            ii = tags.index('num')\n",
-    "            type1 = attributes[ii]['type']\n",
-    "            if(type1=='chiave'):\n",
-    "               csvProt['segnatura_codice'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "\n",
-    "        # e9c 'Segnatura' at the 'subseries' level\n",
-    "        if (attributes[tags.index('c')]['level']=='subseries' or attributes[tags.index('c')]['level']=='file'):\n",
-    "            try:\n",
-    "                ii = tags.index('unitid')\n",
-    "                if(attributes[ii]['type']=='segnatura'):\n",
-    "                    csvProt['segnatura_parent'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "        \n",
-    "        # e10 Title -- first version\n",
-    "        elif('title' in tags):\n",
-    "           csvProt['titolo_originale'] = content        \n",
-    "        \n",
-    "        # e11 Title -- alternative version\n",
-    "        try:\n",
-    "            aa = csvProt['titolo_aspo']\n",
-    "        except:\n",
-    "            try:\n",
-    "                ii = tags.index('unittitle')\n",
-    "                try:\n",
-    "                    tails = \"\"\n",
-    "                    for chi in node['a_par'][ii]:\n",
-    "                        tails = tails + str(chi.tail or '')\n",
-    "                    csvProt['titolo_aspo'] = (str(node['a_par'][ii].text or '') + tails).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    pass                          \n",
-    "            except:\n",
-    "                pass\n",
-    "\n",
-    "        # e12 Scope-content head & body\n",
-    "        if('scopecontent' in tags):\n",
-    "            if('list' not in tags and 'head' in tags):\n",
-    "                csvProt['scope-content_head'] = content\n",
-    "            else:\n",
-    "                if('p' in tags and 'num' not in tags):\n",
-    "                    csvProt['scope-content_body'] = content\n",
-    "                if('num' in tags):\n",
-    "                    try:\n",
-    "                        ii = tags.index('num')\n",
-    "                        if(attributes[ii]['type']):\n",
-    "                            key = 'num_'+ attributes[ii]['type']\n",
-    "                            csvProt[key] = content\n",
-    "                    except:\n",
-    "                        pass    \n",
-    "        # e12b 'lista merci'\n",
-    "        if('scopecontent' in tags):\n",
-    "            if('list' in tags):\n",
-    "                try:\n",
-    "                    ii = tags.index('list')\n",
-    "                    try:\n",
-    "                        csvProt['lista'] = csvProt['lista'] + ' | ' + content\n",
-    "                    except:\n",
-    "                        csvProt['lista'] = content\n",
-    "                except:\n",
-    "                    pass\n",
-    "        \n",
-    "        # e13 Origin\n",
-    "        try:\n",
-    "            ii = tags.index('origination')\n",
-    "            csvProt['origine'] = attributes[ii]['label'] + ': ' + content\n",
-    "        except:\n",
-    "            pass  \n",
-    "        # e14 Company (--> 'compagnia') name\n",
-    "        if ('unittitle' in tags):\n",
-    "            if ('corpname' in tags):\n",
-    "                try:\n",
-    "                    ii = tags.index('corpname')     \n",
-    "                    if (attributes[ii]['authfilenumber'] or attributes[ii]['role']=='compagnia'):\n",
-    "                        try:\n",
-    "                            authId = attributes[ii]['authfilenumber']\n",
-    "                            csvProt['compagnia'] = '{nome: ' + content + ', authID: ' + authId + '}'\n",
-    "                        except:\n",
-    "                            csvProt['compagnia'] = '{nome: ' + content + '}'\n",
-    "                except:\n",
-    "                    pass       \n",
-    "        # e15 Subject (--> 'soggetto') \n",
-    "        try:\n",
-    "            aa = csvProt['soggetto']\n",
-    "        except:\n",
-    "            try:\n",
-    "                ii = tags.index('subject')\n",
-    "                try:\n",
-    "                    csvProt['soggetto'] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    csvProt['soggetto'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "            except:\n",
-    "                pass\n",
-    "        # e15 'tipologia soggetto'\n",
-    "        if('subject' in tags):\n",
-    "            if ('emph' in tags):\n",
-    "                csvProt['tipologia_soggetto'] = content\n",
-    "\n",
-    "        # e16 Person and role\n",
-    "        try:\n",
-    "            ii = tags.index('persname')\n",
-    "            key = 'persona_' + attributes[ii]['role']\n",
-    "            try:\n",
-    "                authId = attributes[ii]['authfilenumber']\n",
-    "                csvProt[key] = '{\"nome\": ' + \"\\\"\" + content + \"\\\"\" + ', \"authID\": ' + \"\\\"\" + authId + \"\\\"\" + '}'\n",
-    "            except:\n",
-    "                csvProt[key] = '{\"nome\": ' + \"\\\"\" + content + \"\\\"\" + '}'\n",
-    "        except:\n",
-    "            pass\n",
-    "                  \n",
-    "        \n",
-    "        # e17 Various dates\n",
-    "        if ('unittitle' in tags):\n",
-    "            try:\n",
-    "                ii = tags.index('date')\n",
-    "                key = 'data_' + attributes[ii]['type']\n",
-    "                aa = csvProt[key]\n",
-    "            except:\n",
-    "                try:\n",
-    "                    ii = tags.index('date')\n",
-    "                    try:\n",
-    "                        csvProt[key] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                        try:\n",
-    "                            ii = tags.index('emph')\n",
-    "                            csvProt[key+'_note'] = content\n",
-    "                        except:\n",
-    "                            pass\n",
-    "                    except:\n",
-    "                        csvProt[key] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    pass \n",
-    "\n",
-    "        # e18 Main date (--> 'data_periodo') + notes\n",
-    "        if('unitdate' in tags):\n",
-    "            csvProt['data_periodo'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "            try:\n",
-    "                ii = tags.index('emph')\n",
-    "                csvProt['data_periodo_note'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "\n",
-    "        # e19 Location (--> 'luogo') and its 'role'\n",
-    "        try:\n",
-    "            ii = tags.index('geogname')\n",
-    "            key = 'luogo_' + attributes[ii]['role']\n",
-    "            try:\n",
-    "                authId = attributes[ii]['authfilenumber']\n",
-    "                csvProt[key] = '{luogo: ' + content + ', authID: ' + authId + '}'\n",
-    "            except:\n",
-    "                csvProt[key] = '{luogo: ' + content + '}'\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e20 Physical medium (--> 'supporto')\n",
-    "        try:\n",
-    "            ii = tags.index('physfacet')\n",
-    "            if(attributes[ii]['type']=='supporto'):\n",
-    "                csvProt['supporto'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e21 Physdesc\n",
-    "        if (attributes[tags.index('c')]['level']!='subfonds'): \n",
-    "            if('physdesc' in tags):\n",
-    "                if('extent' not in tags and 'physfacet' not in tags):\n",
-    "                    csvProt['descrizione_fisica'] = content\n",
-    "                if('extent' in tags):\n",
-    "                    csvProt['numero'] = content\n",
-    "                if('genreform' in tags):\n",
-    "                    csvProt['genere'] = content\n",
-    "        \n",
-    "        # e21 Physdesc for the 'subfonds' level\n",
-    "        if (attributes[tags.index('c')]['level']=='subfonds'):\n",
-    "            try:\n",
-    "                ii = tags.index('extent')\n",
-    "                try:\n",
-    "                    csvProt['numero'] = csvProt['numero'] + ' | ' + content\n",
-    "                except:\n",
-    "                   csvProt['numero'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "                try:\n",
-    "                    ii = tags.index('genreform')\n",
-    "                    try:\n",
-    "                        csvProt['genere'] = csvProt['genere'] + ' | ' + content\n",
-    "                    except:\n",
-    "                        csvProt['genere'] = content\n",
-    "                except:\n",
-    "                    pass              \n",
-    "        # e21 Container (for subseries it counts as an 'extent') \n",
-    "        if (attributes[tags.index('c')]['level']=='subseries'):\n",
-    "            try:\n",
-    "                ii = tags.index('container')\n",
-    "                csvProt['extent'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "        \n",
-    "        # e22 Phystech  \n",
-    "        try:\n",
-    "            ii = tags.index('phystech')\n",
-    "            try:\n",
-    "                csvProt['conservazione'] = csvProt['conservazione'] + ' | ' + content\n",
-    "            except:\n",
-    "                csvProt['conservazione'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e23 Extent (--> 'consistenza')\n",
-    "        try:\n",
-    "            ii = tags.index('extent')\n",
-    "            type1 = attributes[ii]['unit']\n",
-    "            cvsProt['consistenza'] = type1 + ': ' + content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e24 Notes\n",
-    "        if('note' in tags):\n",
-    "            if('p' in tags):\n",
-    "                try:\n",
-    "                    aa = csvProt['nota']\n",
-    "                except:\n",
-    "                    try:\n",
-    "                        ii = tags.index('p')\n",
-    "                        try:\n",
-    "                            csvProt['nota'] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                        except:\n",
-    "                            csvProt['nota'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "                    except:\n",
-    "                        pass\n",
-    "        # e25 Odd\n",
-    "        if('odd' in tags):\n",
-    "            csvProt['altre_informazioni'] = content\n",
-    "        \n",
-    "        # e26 Digital object (--> 'oggetto_digitale') attached (name of)\n",
-    "        # There can be multiple objects attached; they will be all concatenated in a single\n",
-    "        # string with different object names separated by pipes,\n",
-    "        # '| '\n",
-    "        try:\n",
-    "            ii = tags.index('daoloc')\n",
-    "            out = attributes[ii]['title']\n",
-    "            try:\n",
-    "                csvProt['oggetto_digitale'] = csvProt['oggetto_digitale'] + ' | ' + out\n",
-    "            except:\n",
-    "                csvProt['oggetto_digitale'] = out\n",
-    "        except:\n",
-    "            pass\n",
-    "    \n",
-    "    return csvProt\n",
-    "\n",
-    "\n",
-    "\n",
-    "# Ordered dict containing all headers used by the translator function.\n",
-    "itemHeader = OrderedDict()\n",
-    "\n",
-    "# e1 entity ID\n",
-    "itemHeader.update({'id': '<c level=\"X\" id=#>'})\n",
-    "\n",
-    "# e2 Audience: external or internal\n",
-    "itemHeader.update({'audience': '<c level=\"item\" audience=#>'})\n",
-    "\n",
-    "# e3 'Otherlevel' name/description\n",
-    "itemHeader.update({'altro_livello': '<c otherlevel=#>'})\n",
-    "\n",
-    "# e4 Repository (always ASPO in our test case)\n",
-    "itemHeader.update({'repository': '<repository>#'})\n",
-    "\n",
-    "# e5 Bioghist\n",
-    "itemHeader.update({'bioghist': '<bioghist=#>'})\n",
-    "\n",
-    "# e6 Arrangement\n",
-    "itemHeader.update({'arrangement': '<arrangement=#>'})\n",
-    "\n",
-    "# e7 Related Material\n",
-    "itemHeader.update({'relatedmaterial': '<relatedmaterial=#>'})\n",
-    "\n",
-    "# e8 Tipologia\n",
-    "itemHeader.update({'tipologia': '<materialspec label=\"tipologia\">#'})\n",
-    "\n",
-    "# e9a 'Segnature' of 'buste' + 'registri' in Datini collection\n",
-    "itemHeader.update(\n",
-    "{'segnatura_registri_1': '<container type=\"%numero un%\">#',\n",
-    " 'segnatura_registri_2': '<container type=\"%numero sott%\">#',\n",
-    " 'segnatura_inserto': '<container type=\"inserto\">#',\n",
-    " 'segnatura_busta': '<container type=\"busta\">#'})\n",
-    "\n",
-    "# e9b 'Segnatura codice'\n",
-    "itemHeader.update({'segnatura_codice': '<num type=\"chiave\">#'})\n",
-    "\n",
-    "# e9c 'Segnatura' subseries\n",
-    "itemHeader.update(\n",
-    "{'segnatura_parent': '<unitid type=\"segnatura\">#'})\n",
-    "\n",
-    "# e10 Title, first version\n",
-    "itemHeader.update({'titolo_originale': '<title>#'})\n",
-    "\n",
-    "# e11 Title, second version\n",
-    "itemHeader.update({'titolo_aspo': '<unittitle>#'})\n",
-    "\n",
-    "# e12 Scope content, head & body, and # of attached items\n",
-    "itemHeader.update(\n",
-    "{'scope-content_head': '<scopecontent><head>#',\n",
-    " 'scope-content_body': '<scopecontent><p>#', \n",
-    " 'num_allegati': '<num>#'})\n",
-    "\n",
-    "# e12b 'lista merci'\n",
-    "itemHeader.update({'lista': '<list>#'})\n",
-    "\n",
-    "# e13 Origin\n",
-    "itemHeader.update({'origine': '<origination label=#1>#2, #1 - #2'})\n",
-    "\n",
-    "# e14 Company name\n",
-    "itemHeader.update({'compagnia': '<corpname>#'})\n",
-    "\n",
-    "# e15 Subject\n",
-    "itemHeader.update({'soggetto': '<subject>#'})\n",
-    "itemHeader.update({'tipologia_soggetto': '<emph>#'})\n",
-    "\n",
-    "# e16 Person + role\n",
-    "itemHeader.update(\n",
-    "{'persona_tenutario': '<persname role=\"tenutario\">#', \n",
-    " 'persona_destinatario': '<persname role=\"destinatario\">#',\n",
-    " 'persona_mittente': '<persname role=\"mittente\">#',\n",
-    " 'persona_indirizzata': '<persname role=\"indirizzata\">#',\n",
-    " 'persona_mano': '<persname role=\"mano\">#',})\n",
-    "\n",
-    "# e17 Dates\n",
-    "itemHeader.update(\n",
-    "{'data_inizio': '<date type=\"inizio\">#', 'data_inizio_note': '<emph>#',\n",
-    " 'data_fine': '<date type=\"fine\">#', 'data_fine_note': '<emph>#',\n",
-    " 'data_chiusura': '<date type=\"chiusura\">#', 'data_chiusura_note': '<emph>#'})\n",
-    "\n",
-    "# e18 Main date: 'periodo'\n",
-    "itemHeader.update({'data_periodo': '<unitdate>#' , 'data_periodo_note': '<unitdate>#'})\n",
-    "\n",
-    "# e19 Location + 'role'\n",
-    "itemHeader.update(\n",
-    "{\"luogo_partenza\": '<geogname role=\"partenza\">#',\n",
-    " \"luogo_arrivo\": '<geogname role=\"arrivo\">#',\n",
-    " \"luogo_luogo\": '<geogname role=\"luogo\">#'})\n",
-    "\n",
-    "# e20 Physical medium\n",
-    "itemHeader.update({'supporto': '<physfacet type=\"supporto\">#'})\n",
-    "\n",
-    "# e21 Physical description\n",
-    "itemHeader.update({'descrizione_fisica': '<physdesc>#'})\n",
-    "itemHeader.update({'numero': '<extent>#'})\n",
-    "# 'container' counts as 'extent' for subseries only\n",
-    "itemHeader.update({'extent': '<container>#'})\n",
-    "itemHeader.update({'genere': '<genreform>#'})\n",
-    "\n",
-    "# e22 phystech\n",
-    "itemHeader.update({'conservazione': '<phystech>#'})\n",
-    "\n",
-    "# e23 Extent\n",
-    "itemHeader.update({'consistenza': '<extent unit=#1>#2, #1: #2'})\n",
-    "\n",
-    "# e24 Notes\n",
-    "itemHeader.update({'nota': '<note>#'})\n",
-    "\n",
-    "# e25 Odd\n",
-    "itemHeader.update({'altre_informazioni': '<odd>#'})\n",
-    "\n",
-    "# e26 Digital objects attached\n",
-    "itemHeader.update({'oggetto_digitale': '<daoloc title=#>'})\n",
-    "\n",
-    "# e0: Parent nodes IDs\n",
-    "itemHeader.update(\n",
-    "{'id_subfonds': '<c level=\"subfonds\" id=#>',\n",
-    " 'id_fonds': '<c level=\"fonds\" id=#>',\n",
-    " 'id_series': '<c level=\"series\" id=#>',\n",
-    " 'id_subseries': '<c level=\"subseries\" id=#>',\n",
-    " 'id_file': '<c level=\"file\" id=#>',\n",
-    " 'id_otherlevel': '<c level=\"otherlevel\" id=#>',\n",
-    " 'id_collection': '<c level=\"collection\" id=#>'})"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "**Our custom functions to extend ElementTree's parsing capabilities**"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# The traceElems function\n",
-    "def traceElems(node: ET.Element, condition, parents: list = [], coords: list = []):\n",
-    "    res = []\n",
-    "    jj = 0\n",
-    "    for child in node:\n",
-    "        if condition(child):\n",
-    "            res.append({'a_par': parents+[node],\n",
-    "                        'coords': coords+[jj], 'child': child})\n",
-    "        else:\n",
-    "            res = res + traceElems(child, condition, parents+[node], coords+[jj])\n",
-    "        jj = jj+1   \n",
-    "    return res\n",
-    "\n",
-    "# The default function we use as a condition for traceElems: returns 'True' if a node is a 'leaf' (that is, it has no child nodes) or if the node tag is 'c' -- the tag used for the basic items in a collection in the EAD standard.\n",
-    "def isLeafOrC(aa: ET.Element):\n",
-    "    if(aa.tag=='c' or len(aa)==0):\n",
-    "        return True\n",
-    "    else:\n",
-    "        return False"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Extra utilities"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 12,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Some simple utility functions used only for testing\n",
-    "def shownode(node: ET.Element):\n",
-    "    return (node.tag, node.attrib, node.text.replace('\\t','').replace('\\n','').strip() \\\n",
-    "                               if type(node.text) is str else '')\n",
-    "#\n",
-    "def shownodelist(el: ET.Element):\n",
-    "    return list(map(shownode, el))\n",
-    "\n",
-    "\n",
-    "# An extension of the standard str.index method which returns the position index of all elements in the 'lst' argument which are equal to the 'element' argument\n",
-    "def indices(lst, element):\n",
-    "    result = []\n",
-    "    offset = -1\n",
-    "    while True:\n",
-    "        try:\n",
-    "            offset = lst.index(element, offset+1)\n",
-    "        except ValueError:\n",
-    "            return result\n",
-    "        result.append(offset)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Parsing and data processing"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Parse the input file using ElementTree, returning a *root* object, and tracking the elapsed time"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "19.120107889175415\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "treeDatini = ET.parse(import_dir + input_file)\n",
-    "rootDatini = treeDatini.getroot()\n",
-    "\n",
-    "ts2 = datetime.timestamp(datetime.now())\n",
-    "print(ts2 - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Use the *iter* function to track all nodes in the main *root* object having tag **c**; get the **level** attributes of all such nodes; save all different *levels* in the variable **cLevs**"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'subfonds', 'fonds', 'file', 'collection', 'subseries', 'series', 'item', 'otherlevel'}\n"
-     ]
-    }
-   ],
-   "source": [
-    "cLevs = set(map(lambda a : a.attrib['level'], rootDatini.iter('c')))\n",
-    "print(cLevs)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Now we use *traceElems* to record all nodes with tag **c** as well as their parent nodes, organising them according to the value of their **level** attribute; we also print the number of such levels as well as the elapsed time.\n",
-    "\n",
-    "Since by construction *traceElems* doesn't go inside the nodes it returns, this is done in two steps, first collecting top-level **c**-nodes at a given **level**, then iterating through them to find any children with the same tag and attribute inside them."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "# of \"c\" tags at subfondslevel, first pass: 14\n",
-      "# of \"c\" tags at fondslevel, first pass: 1\n",
-      "# of \"c\" tags at filelevel, first pass: 15449\n",
-      "# of \"c\" tags at collectionlevel, first pass: 1\n",
-      "# of \"c\" tags at subserieslevel, first pass: 1365\n",
-      "# of \"c\" tags at serieslevel, first pass: 35\n",
-      "# of \"c\" tags at itemlevel, first pass: 149085\n",
-      "# of \"c\" tags at otherlevellevel, first pass: 10\n",
-      "\n",
-      "Elapsed time: 8.929772138595581\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "allCs = {}\n",
-    "\n",
-    "for label in cLevs:\n",
-    "    def tempFilt(aa: ET.Element):\n",
-    "        if(aa.tag=='c' and aa.attrib['level']==label):\n",
-    "            return True\n",
-    "        else:\n",
-    "            return False\n",
-    "       \n",
-    "    allCs[label] = traceElems(rootDatini, tempFilt);\n",
-    "    print('# of \"c\" tags at ' + label + 'level, first pass:', len(allCs[label]))\n",
-    "\n",
-    "print()\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Second pass"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "# of \"c\" tags at subfondslevel, first pass: 14\n",
-      "# of \"c\" tags at subfondslevel, total: 14\n",
-      "# of \"c\" tags at fondslevel, first pass: 1\n",
-      "# of \"c\" tags at fondslevel, total: 1\n",
-      "# of \"c\" tags at filelevel, first pass: 15449\n",
-      "# of \"c\" tags at filelevel, total: 15449\n",
-      "# of \"c\" tags at collectionlevel, first pass: 1\n",
-      "# of \"c\" tags at collectionlevel, total: 4\n",
-      "# of \"c\" tags at subserieslevel, first pass: 1365\n",
-      "# of \"c\" tags at subserieslevel, total: 1477\n",
-      "# of \"c\" tags at serieslevel, first pass: 35\n",
-      "# of \"c\" tags at serieslevel, total: 61\n",
-      "# of \"c\" tags at itemlevel, first pass: 149085\n",
-      "# of \"c\" tags at itemlevel, total: 149085\n",
-      "# of \"c\" tags at otherlevellevel, first pass: 10\n",
-      "# of \"c\" tags at otherlevellevel, total: 10\n",
-      "\n",
-      "Elapsed time: 20.77740502357483\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "allCs2 = {}\n",
-    "\n",
-    "for label in cLevs:\n",
-    "    partial = allCs[label]\n",
-    "    print('# of \"c\" tags at ' + label + 'level, first pass:', len(partial))\n",
-    "    allCs2[label] = partial\n",
-    "    partialUpdate = []\n",
-    "    while True:\n",
-    "        def tempFilt(aa: ET.Element):\n",
-    "            if(aa.tag=='c' and aa.attrib['level']==label):\n",
-    "                 return True\n",
-    "            else:\n",
-    "                 return False\n",
-    "        for node in partial:\n",
-    "            partialUpdate = partialUpdate + traceElems(node['child'], tempFilt)\n",
-    "        #print(len(partialUpdate))\n",
-    "        partial = partialUpdate\n",
-    "        if(len(partialUpdate)==0):\n",
-    "            break\n",
-    "        allCs2[label] = allCs2[label] + partial\n",
-    "        partialUpdate = []\n",
-    "\n",
-    "    print('# of \"c\" tags at ' + label + 'level, total:', len(allCs2[label]))\n",
-    "\n",
-    "print()\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Now it is easy to visualise/retrieve all information stored in **c** nodes, at any level, including their parent nodes and their location in the tree.\n",
-    "\n",
-    "An example (which can be easily tuned by changing the values of local variables, particularly **ii** and **level**), is given in next cell."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Level: otherlevel\n",
-      "#: 1\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('did', {}, '')]\n",
-      "[0, 0]\n",
-      "('unittitle', {'encodinganalog': 'ISAD 1 - 2 title'}, 'Busta 1167')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('processinfo', {}, ''), ('list', {}, ''), ('item', {}, '')]\n",
-      "[1, 0, 0, 0]\n",
-      "('date', {}, '19/03/2013')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('processinfo', {}, ''), ('list', {}, ''), ('item', {}, '')]\n",
-      "[1, 0, 0, 1]\n",
-      "('persname', {}, 'Admin xDams - open source')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 0]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164307', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 1]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164308', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 2]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164309', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 3]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164310', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 4]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164311', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 5]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164312', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 6]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164313', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 7]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164314', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 8]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164315', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 9]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164316', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 10]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164317', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 11]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164318', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 12]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164319', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 13]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164320', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 14]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164321', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 15]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164322', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 16]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164323', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 17]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164324', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 18]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164325', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 19]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164326', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 20]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164327', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 21]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164328', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 22]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164329', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 23]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164330', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 24]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164331', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 25]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164332', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 26]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164333', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 27]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164334', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 28]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164335', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 29]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164336', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 30]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164337', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 31]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164338', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 32]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164339', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 33]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164340', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 34]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164341', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 35]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164342', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 36]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164343', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 37]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164344', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 38]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164345', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 39]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164346', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 40]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164347', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 41]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164348', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 42]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164349', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 43]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164350', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 44]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164351', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 45]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164352', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 46]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164353', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 47]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164354', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 48]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164355', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 49]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164356', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 50]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164357', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 51]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164358', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 52]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164359', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 53]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164360', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 54]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164361', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 55]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164362', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 56]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164363', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 57]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164364', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 58]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164365', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 59]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164366', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 60]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164367', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 61]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164368', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 62]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164369', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 63]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164370', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 64]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164371', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 65]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164372', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 66]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164373', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 67]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164374', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 68]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164375', 'level': 'item'}, '')\n",
-      "# of children: 3\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 69]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164376', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 70]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164377', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 71]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164378', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 72]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164379', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 73]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164380', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 74]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164381', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 75]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164382', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 76]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164383', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 77]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164384', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 78]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164385', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 79]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164386', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 80]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164387', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 81]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164388', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 82]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164389', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 83]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164390', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 84]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164391', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 85]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164392', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 86]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164393', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 87]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164394', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 88]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164395', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 89]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164396', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 90]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164397', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 91]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164398', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 92]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164399', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 93]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164400', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 94]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164401', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 95]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164402', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 96]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164403', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 97]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164404', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 98]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164405', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 99]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164406', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 100]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164407', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 101]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164408', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 102]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164409', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 103]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164410', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 104]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164411', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 105]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164412', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 106]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164413', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 107]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164414', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 108]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164415', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 109]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164416', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 110]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164417', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 111]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164418', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 112]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164419', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 113]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164420', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 114]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164421', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 115]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164422', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 116]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164423', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 117]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164424', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 118]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164425', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 119]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164426', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 120]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164427', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 121]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164428', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 122]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164429', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 123]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164430', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 124]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164431', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 125]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164432', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 126]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164433', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 127]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164434', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 128]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164435', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 129]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164436', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 130]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164437', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 131]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164438', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 132]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164439', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 133]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164440', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 134]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164441', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 135]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164442', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 136]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164443', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 137]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164444', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 138]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164445', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 139]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164446', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 140]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164447', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 141]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164448', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 142]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164449', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 143]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164450', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 144]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164451', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 145]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164452', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 146]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164453', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 147]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164454', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 148]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164455', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 149]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164456', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 150]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164457', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 151]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164458', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 152]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164459', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 153]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164460', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 154]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164461', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 155]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164462', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 156]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164463', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 157]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164464', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 158]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164465', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 159]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164466', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 160]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164467', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 161]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164468', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 162]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164469', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "ii = 1\n",
-    "level = 'otherlevel'\n",
-    "test = allCs2[level][ii]\n",
-    "toProc = traceElems(test['child'], isLeafOrC)\n",
-    "\n",
-    "# Comment/uncomment to print info here / on a text file\n",
-    "# (also comment/uncomment the last two lines of this cell)\n",
-    "#testFileName = 'info.txt'\n",
-    "#orig_stdout = sys.stdout\n",
-    "#fp = open(export_dir + testFileName, 'w')\n",
-    "#sys.stdout = fp\n",
-    "#\n",
-    "\n",
-    "print('Level:', level)\n",
-    "print('#:', ii)\n",
-    "print()\n",
-    "for node in toProc:\n",
-    "    print(shownodelist(node['a_par']))\n",
-    "    print(node['coords'])\n",
-    "    print(shownode(node['child']))\n",
-    "    print('# of children:', len(node['child']))\n",
-    "    print()\n",
-    "\n",
-    "\n",
-    "# Comment/uncomment to print info here / on a text file\n",
-    "#sys.stdout = orig_stdout\n",
-    "#fp.close()"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Test the translator function on a single **c** node"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {
-    "scrolled": true
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "148225\n",
-      "\n",
-      "id_fonds: ASPO00000000\n",
-      "\n",
-      "id_collection: ASPO00164879\n",
-      "\n",
-      "id_otherlevel: ASPO00165135\n",
-      "\n",
-      "id: ASPO00165216\n",
-      "\n",
-      "audience: internal\n",
-      "\n",
-      "oggetto_digitale: AS000162002.jpg | AS000162001.jpg\n",
-      "\n",
-      "segnatura_busta: 1173\n",
-      "\n",
-      "tipologia: documenti diversi\n",
-      "\n",
-      "origine: Fondaco: FIRENZE\n",
-      "\n",
-      "supporto: CARTACEO\n",
-      "\n",
-      "segnatura_codice: 1620\n",
-      "\n",
-      "titolo_aspo: CAMPIONE DI STOFFE\n",
-      "\n",
-      "soggetto: CAMPIONE DI STOFFE\n",
-      "\n",
-      "nota: CAMPIONE DI STOFFE. SI TRATTA PROBABILMENTE DI UN ALLEGATO DI UN LETTERA DALLA COMP. DATINI DI  BARCELLONA ALLA COMP. DATINI DI FIRENZE (1402 O 1403). EDITO IN F. MELIS,dOCUMENTI PER LA STORIA ECONOMICA MEDIEVALE, P. 288.\n",
-      "\n",
-      "scope-content_body: INDICAZIONE DEI COLORI DI PANNO LANA RICHIESTI SULLA PIAZZA DI BARCELLONA CON CUCITE 4 STRISCE DI TESSUTO NEI COLORI PAONAZZO, VERDE, CILISTRINO E SCARLATTO.\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "jj = randint(0, len(allCs2['item']))\n",
-    "jj = 148225\n",
-    "print(jj)\n",
-    "print()\n",
-    "\n",
-    "test = allCs2['item'][jj]\n",
-    "toShow = translator(test)\n",
-    "for key in toShow.keys():\n",
-    "    print(key + ': ' + str(toShow[key]))\n",
-    "    print()"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Export\n",
-    "\n",
-    "We are now ready to produce the output csv file. We will output one csv for each level, starting from the main level, *item*."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 54.635375022888184\n"
-     ]
-    }
-   ],
-   "source": [
-    "# Do it! CSV export - 'item' level.\n",
-    "\n",
-    "levelName = 'item'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "# Open output file\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    # Define the writer class for the export\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(itemHeader.keys()))\n",
-    "    # Write the header\n",
-    "    writer.writeheader()\n",
-    "    # Write the second line -- a customised 'comment line'\n",
-    "    writer.writerow(itemHeader)\n",
-    "    # Loop on items\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Other levels\n",
-    "\n",
-    "Levels different from *item* generally have less entries. To avoid having several blank columns in the csv, we reduce the orderedDict containing the headers before producing the file."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 21,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.9631688594818115\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'subseries'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 23,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.08457398414611816\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'series'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 24,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.018197059631347656\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'subfonds'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 25,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.0016989707946777344\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'fonds'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 26,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 6.7647480964660645\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'file'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 27,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.001964092254638672\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'collection'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 28,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.07008790969848633\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'otherlevel'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-  },
-  "kernelspec": {
-   "display_name": "Python 3",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.6.9"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 4
-}

+ 0 - 2133
tempWork/EAD_to_CSV_datini.ipynb

@@ -1,2133 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# SETUP"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Input\n",
-    "\n",
-    "As a first step, define local parameters affecting the behaviour of the script. There are three:\n",
-    "- *import_dir*: the directory the input xml file is located in\n",
-    "- *input_file*: the full name of the input file\n",
-    "- *export_dir*: the name of the directory the output file(s) will be saved to (must be already existing when the script is run)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 1,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import_dir = '/home/kora/Desktop/OVI_Data_Local/ASPO/XML/'\n",
-    "input_file = 'export_aspoSt001--datini.xml'\n",
-    "export_dir = '/home/kora/Desktop/OVI_Data_Local/ASPO/CSV/Datini/'"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Packages\n",
-    "\n",
-    "For clarity, define here all the **package imports** which are needed to run the script"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 2,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# ESSENTIAL IMPORTS\n",
-    "\n",
-    "# The XML parser this work is based on\n",
-    "import xml.etree.ElementTree as ET\n",
-    "# Utilities for reading/writing csv files\n",
-    "import csv\n",
-    "# Utilities to handle character encodings\n",
-    "import unicodedata\n",
-    "# Ordered dicts: the main structure we store data in before exporting to CSV\n",
-    "from collections import OrderedDict\n",
-    "\n",
-    "\n",
-    "# ADDITIONAL (OPTIONAL) IMPORTS\n",
-    "\n",
-    "# Used to make simple performance estimates by recording the time needed to run various sets of commands\n",
-    "from datetime import datetime\n",
-    "# Psuedorandom number generator useful for testing\n",
-    "from random import *\n",
-    "\n",
-    "# Può servire per alcuni test\n",
-    "import sys"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Functions\n",
-    "\n",
-    "Here we define a set of custom functions to extend ElementTree's capabilities\n",
-    "\n",
-    "**ElementTree** has a very efficient built-in function, **iter**, which can be used to search all nodes of an XML tree for specific kinds of data. However, *iter* does not automatically detect the *parent nodes* of the elements it tracks, which is by contrast something we need to be able to do in general.\n",
-    "\n",
-    "For this reason we defined a custom *iter*-like function, **traceElems**, which can be used to do just that.\n",
-    "\n",
-    "*traceElems* parses the nodes on a tree storing info about their parent nodes, returning all those for which the argument function 'condition' returns True. Note that *traceElems* by design **DOES NOT** parse the *child* nodes of those it returns.\n",
-    "\n",
-    "We also define a **translator function** which will parse the output of *traceElems* and save them in an *ordered dict*, suitable for their export in a csv file. **THIS IS THE FUNCTION YOU'LL WANT TO EDIT IN ORDER TO PERSONALISE THE PARSER TO DEAL WITH SPECIFIC EAD DOCUMENTS**, if needed.\n",
-    "\n",
-    "Finally, we define some extra utility functions."
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "**The translator**\n",
-    "\n",
-    "*This is the function you'll want to edit in order to personalise the parser to deal with specific EAD documents*"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 3,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Our test case is a collection of the 'Archivio Statale' of Prato, Italy (ASPO); for this reason, some of the information in the xml file and the translator function is in Italian.\n",
-    "\n",
-    "\n",
-    "# Translator function\n",
-    "def translator(elem):\n",
-    "    # Define the output variable\n",
-    "    csvProt = {}\n",
-    "\n",
-    "    # Process the parent nodes of 'elem', recording their tags and attributes\n",
-    "    par_tags = list(map(lambda a: a.tag, elem['a_par']))\n",
-    "    par_attributes = list(map(lambda a: a.attrib, elem['a_par']))\n",
-    "    \n",
-    "    # e0: 'id' attributes of the parent nodes\n",
-    "    for ii in indices(par_tags, 'c'):\n",
-    "        key = 'id_' + par_attributes[ii]['level']\n",
-    "        csvProt[key] = par_attributes[ii]['id']\n",
-    "\n",
-    "    #\n",
-    "    # Process the children nodes of 'elem', stopping at any 'c' sub-tag\n",
-    "    toProc = traceElems(elem['child'], isLeafOrC)\n",
-    "    first = True\n",
-    "    for node in toProc:\n",
-    "        tags = list(map(lambda a: a.tag, node['a_par'])) + [node['child'].tag]\n",
-    "        attributes = list(map(lambda a: a.attrib, node['a_par'])) + [node['child'].attrib]\n",
-    "        content = node['child'].text\n",
-    "\n",
-    "        # Infos to check for the first child only (they'll equal for all children in a well-formed file)\n",
-    "        if(first):\n",
-    "            # e1 'id' attribute of 'elem'\n",
-    "            csvProt['id'] = attributes[tags.index('c')]['id']\n",
-    "            # e2 'audience' attribute of 'elem' (should be either 'external' or 'internal')\n",
-    "            try:\n",
-    "                csvProt['audience'] = attributes[tags.index('c')]['audience']\n",
-    "            except:\n",
-    "                pass\n",
-    "            # e3 Otherlevel\n",
-    "            try:\n",
-    "                csvProt['altro_livello'] = attributes[tags.index('c')]['otherlevel']\n",
-    "            except:\n",
-    "                pass\n",
-    "            first = False\n",
-    "\n",
-    "        # e4 Repository\n",
-    "        if('repository' in tags):\n",
-    "            csvProt['repository'] = content  \n",
-    "\n",
-    "        # e5 Bioghits\n",
-    "        if('bioghist' in tags):\n",
-    "            csvProt['bioghist'] = content    \n",
-    "        # e6 Arrangement\n",
-    "        elif('arrangement' in tags):\n",
-    "            csvProt['arrangement'] = content\n",
-    "        # e7 Related Material\n",
-    "        elif('relatedmaterial' in tags):\n",
-    "            csvProt['relatedmaterial'] = content\n",
-    "        \n",
-    "        # e8 'Tipologia'\n",
-    "        try:\n",
-    "            ii = tags.index('materialspec')\n",
-    "            if(attributes[ii]['label']=='tipologia'):\n",
-    "                csvProt['tipologia'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e9a 'Segnatura' of 'buste' and 'registri' in ASPO's 'Datini' collection\n",
-    "        try:\n",
-    "            ii = tags.index('container')\n",
-    "            type1 = attributes[ii]['type']\n",
-    "            if(type1.find('numero un')>=0):\n",
-    "                csvProt['segnatura_registri_1'] = content\n",
-    "            elif(type1.find('numero sott')>=0):\n",
-    "                csvProt['segnatura_registri_2'] = content\n",
-    "            elif(type1=='busta'):\n",
-    "                csvProt['segnatura_busta'] = content\n",
-    "            elif(type1=='inserto'):\n",
-    "                csvProt['segnatura_inserto'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        # e9b 'Segnatura codice'\n",
-    "        try:\n",
-    "            ii = tags.index('num')\n",
-    "            type1 = attributes[ii]['type']\n",
-    "            if(type1=='chiave'):\n",
-    "               csvProt['segnatura_codice'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "\n",
-    "        # e9c 'Segnatura' at the 'subseries' level\n",
-    "        if (attributes[tags.index('c')]['level']=='subseries' or attributes[tags.index('c')]['level']=='file'):\n",
-    "            try:\n",
-    "                ii = tags.index('unitid')\n",
-    "                if(attributes[ii]['type']=='segnatura'):\n",
-    "                    csvProt['segnatura_parent'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "        \n",
-    "        # e10 Title -- first version\n",
-    "        elif('title' in tags):\n",
-    "           csvProt['titolo_originale'] = content        \n",
-    "        \n",
-    "        # e11 Title -- alternative version\n",
-    "        try:\n",
-    "            aa = csvProt['titolo_aspo']\n",
-    "        except:\n",
-    "            try:\n",
-    "                ii = tags.index('unittitle')\n",
-    "                try:\n",
-    "                    tails = \"\"\n",
-    "                    for chi in node['a_par'][ii]:\n",
-    "                        tails = tails + str(chi.tail or '')\n",
-    "                    csvProt['titolo_aspo'] = (str(node['a_par'][ii].text or '') + tails).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    pass                          \n",
-    "            except:\n",
-    "                pass\n",
-    "\n",
-    "        # e12 Scope-content head & body\n",
-    "        if('scopecontent' in tags):\n",
-    "            if('list' not in tags and 'head' in tags):\n",
-    "                csvProt['scope-content_head'] = content\n",
-    "            else:\n",
-    "                if('p' in tags and 'num' not in tags):\n",
-    "                    csvProt['scope-content_body'] = content\n",
-    "                if('num' in tags):\n",
-    "                    try:\n",
-    "                        ii = tags.index('num')\n",
-    "                        if(attributes[ii]['type']):\n",
-    "                            key = 'num_'+ attributes[ii]['type']\n",
-    "                            csvProt[key] = content\n",
-    "                    except:\n",
-    "                        pass    \n",
-    "        # e12b 'lista merci'\n",
-    "        if('scopecontent' in tags):\n",
-    "            if('list' in tags):\n",
-    "                try:\n",
-    "                    ii = tags.index('list')\n",
-    "                    try:\n",
-    "                        csvProt['lista'] = csvProt['lista'] + ' | ' + content\n",
-    "                    except:\n",
-    "                        csvProt['lista'] = content\n",
-    "                except:\n",
-    "                    pass\n",
-    "        \n",
-    "        # e13 Origin\n",
-    "        try:\n",
-    "            ii = tags.index('origination')\n",
-    "            csvProt['origine'] = attributes[ii]['label'] + ': ' + content\n",
-    "        except:\n",
-    "            pass  \n",
-    "        # e14 Company (--> 'compagnia') name\n",
-    "        if ('unittitle' in tags):\n",
-    "            if ('corpname' in tags):\n",
-    "                try:\n",
-    "                    ii = tags.index('corpname')     \n",
-    "                    if (attributes[ii]['authfilenumber'] or attributes[ii]['role']=='compagnia'):\n",
-    "                        try:\n",
-    "                            authId = attributes[ii]['authfilenumber']\n",
-    "                            csvProt['compagnia'] = '{nome: ' + content + ', authID: ' + authId + '}'\n",
-    "                        except:\n",
-    "                            csvProt['compagnia'] = '{nome: ' + content + '}'\n",
-    "                except:\n",
-    "                    pass       \n",
-    "        # e15 Subject (--> 'soggetto') \n",
-    "        try:\n",
-    "            aa = csvProt['soggetto']\n",
-    "        except:\n",
-    "            try:\n",
-    "                ii = tags.index('subject')\n",
-    "                try:\n",
-    "                    csvProt['soggetto'] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    csvProt['soggetto'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "            except:\n",
-    "                pass\n",
-    "        # e15 'tipologia soggetto'\n",
-    "        if('subject' in tags):\n",
-    "            if ('emph' in tags):\n",
-    "                csvProt['tipologia_soggetto'] = content\n",
-    "\n",
-    "        # e16 Person and role\n",
-    "        try:\n",
-    "            ii = tags.index('persname')\n",
-    "            key = 'persona_' + attributes[ii]['role']\n",
-    "            try:\n",
-    "                authId = attributes[ii]['authfilenumber']\n",
-    "                csvProt[key] = '{\"nome\": ' + \"\\\"\" + content + \"\\\"\" + ', \"authID\": ' + \"\\\"\" + authId + \"\\\"\" + '}'\n",
-    "            except:\n",
-    "                csvProt[key] = '{\"nome\": ' + \"\\\"\" + content + \"\\\"\" + '}'\n",
-    "        except:\n",
-    "            pass\n",
-    "                  \n",
-    "        \n",
-    "        # e17 Various dates\n",
-    "        if ('unittitle' in tags):\n",
-    "            try:\n",
-    "                ii = tags.index('date')\n",
-    "                key = 'data_' + attributes[ii]['type']\n",
-    "                aa = csvProt[key]\n",
-    "            except:\n",
-    "                try:\n",
-    "                    ii = tags.index('date')\n",
-    "                    try:\n",
-    "                        csvProt[key] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                        try:\n",
-    "                            ii = tags.index('emph')\n",
-    "                            csvProt[key+'_note'] = content\n",
-    "                        except:\n",
-    "                            pass\n",
-    "                    except:\n",
-    "                        csvProt[key] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "                except:\n",
-    "                    pass \n",
-    "\n",
-    "        # e18 Main date (--> 'data_periodo') + notes\n",
-    "        if('unitdate' in tags):\n",
-    "            csvProt['data_periodo'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "            try:\n",
-    "                ii = tags.index('emph')\n",
-    "                csvProt['data_periodo_note'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "\n",
-    "        # e19 Location (--> 'luogo') and its 'role'\n",
-    "        try:\n",
-    "            ii = tags.index('geogname')\n",
-    "            key = 'luogo_' + attributes[ii]['role']\n",
-    "            try:\n",
-    "                authId = attributes[ii]['authfilenumber']\n",
-    "                csvProt[key] = '{luogo: ' + content + ', authID: ' + authId + '}'\n",
-    "            except:\n",
-    "                csvProt[key] = '{luogo: ' + content + '}'\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e20 Physical medium (--> 'supporto')\n",
-    "        try:\n",
-    "            ii = tags.index('physfacet')\n",
-    "            if(attributes[ii]['type']=='supporto'):\n",
-    "                csvProt['supporto'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e21 Physdesc\n",
-    "        if (attributes[tags.index('c')]['level']!='subfonds'): \n",
-    "            if('physdesc' in tags):\n",
-    "                if('extent' not in tags and 'physfacet' not in tags):\n",
-    "                    csvProt['descrizione_fisica'] = content\n",
-    "                if('extent' in tags):\n",
-    "                    csvProt['numero'] = content\n",
-    "                if('genreform' in tags):\n",
-    "                    csvProt['genere'] = content\n",
-    "        \n",
-    "        # e21 Physdesc for the 'subfonds' level\n",
-    "        if (attributes[tags.index('c')]['level']=='subfonds'):\n",
-    "            try:\n",
-    "                ii = tags.index('extent')\n",
-    "                try:\n",
-    "                    csvProt['numero'] = csvProt['numero'] + ' | ' + content\n",
-    "                except:\n",
-    "                   csvProt['numero'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "                try:\n",
-    "                    ii = tags.index('genreform')\n",
-    "                    try:\n",
-    "                        csvProt['genere'] = csvProt['genere'] + ' | ' + content\n",
-    "                    except:\n",
-    "                        csvProt['genere'] = content\n",
-    "                except:\n",
-    "                    pass              \n",
-    "        # e21 Container (for subseries it counts as an 'extent') \n",
-    "        if (attributes[tags.index('c')]['level']=='subseries'):\n",
-    "            try:\n",
-    "                ii = tags.index('container')\n",
-    "                csvProt['extent'] = content\n",
-    "            except:\n",
-    "                pass\n",
-    "        \n",
-    "        # e22 Phystech  \n",
-    "        try:\n",
-    "            ii = tags.index('phystech')\n",
-    "            try:\n",
-    "                csvProt['conservazione'] = csvProt['conservazione'] + ' | ' + content\n",
-    "            except:\n",
-    "                csvProt['conservazione'] = content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e23 Extent (--> 'consistenza')\n",
-    "        try:\n",
-    "            ii = tags.index('extent')\n",
-    "            type1 = attributes[ii]['unit']\n",
-    "            cvsProt['consistenza'] = type1 + ': ' + content\n",
-    "        except:\n",
-    "            pass\n",
-    "        \n",
-    "        # e24 Notes\n",
-    "        if('note' in tags):\n",
-    "            if('p' in tags):\n",
-    "                try:\n",
-    "                    aa = csvProt['nota']\n",
-    "                except:\n",
-    "                    try:\n",
-    "                        ii = tags.index('p')\n",
-    "                        try:\n",
-    "                            csvProt['nota'] = str(node['a_par'][ii].text).replace('\\t','').replace('\\n','').strip()\n",
-    "                        except:\n",
-    "                            csvProt['nota'] = str(content).replace('\\t','').replace('\\n','').strip()\n",
-    "                    except:\n",
-    "                        pass\n",
-    "        # e25 Odd\n",
-    "        if('odd' in tags):\n",
-    "            csvProt['altre_informazioni'] = content\n",
-    "        \n",
-    "        # e26 Digital object (--> 'oggetto_digitale') attached (name of)\n",
-    "        # There can be multiple objects attached; they will be all concatenated in a single\n",
-    "        # string with different object names separated by pipes,\n",
-    "        # '| '\n",
-    "        try:\n",
-    "            ii = tags.index('daoloc')\n",
-    "            out = attributes[ii]['title']\n",
-    "            try:\n",
-    "                csvProt['oggetto_digitale'] = csvProt['oggetto_digitale'] + ' | ' + out\n",
-    "            except:\n",
-    "                csvProt['oggetto_digitale'] = out\n",
-    "        except:\n",
-    "            pass\n",
-    "    \n",
-    "    return csvProt\n",
-    "\n",
-    "\n",
-    "\n",
-    "# Ordered dict containing all headers used by the translator function.\n",
-    "itemHeader = OrderedDict()\n",
-    "\n",
-    "# e1 entity ID\n",
-    "itemHeader.update({'id': '<c level=\"X\" id=#>'})\n",
-    "\n",
-    "# e2 Audience: external or internal\n",
-    "itemHeader.update({'audience': '<c level=\"item\" audience=#>'})\n",
-    "\n",
-    "# e3 'Otherlevel' name/description\n",
-    "itemHeader.update({'altro_livello': '<c otherlevel=#>'})\n",
-    "\n",
-    "# e4 Repository (always ASPO in our test case)\n",
-    "itemHeader.update({'repository': '<repository>#'})\n",
-    "\n",
-    "# e5 Bioghist\n",
-    "itemHeader.update({'bioghist': '<bioghist=#>'})\n",
-    "\n",
-    "# e6 Arrangement\n",
-    "itemHeader.update({'arrangement': '<arrangement=#>'})\n",
-    "\n",
-    "# e7 Related Material\n",
-    "itemHeader.update({'relatedmaterial': '<relatedmaterial=#>'})\n",
-    "\n",
-    "# e8 Tipologia\n",
-    "itemHeader.update({'tipologia': '<materialspec label=\"tipologia\">#'})\n",
-    "\n",
-    "# e9a 'Segnature' of 'buste' + 'registri' in Datini collection\n",
-    "itemHeader.update(\n",
-    "{'segnatura_registri_1': '<container type=\"%numero un%\">#',\n",
-    " 'segnatura_registri_2': '<container type=\"%numero sott%\">#',\n",
-    " 'segnatura_inserto': '<container type=\"inserto\">#',\n",
-    " 'segnatura_busta': '<container type=\"busta\">#'})\n",
-    "\n",
-    "# e9b 'Segnatura codice'\n",
-    "itemHeader.update({'segnatura_codice': '<num type=\"chiave\">#'})\n",
-    "\n",
-    "# e9c 'Segnatura' subseries\n",
-    "itemHeader.update(\n",
-    "{'segnatura_parent': '<unitid type=\"segnatura\">#'})\n",
-    "\n",
-    "# e10 Title, first version\n",
-    "itemHeader.update({'titolo_originale': '<title>#'})\n",
-    "\n",
-    "# e11 Title, second version\n",
-    "itemHeader.update({'titolo_aspo': '<unittitle>#'})\n",
-    "\n",
-    "# e12 Scope content, head & body, and # of attached items\n",
-    "itemHeader.update(\n",
-    "{'scope-content_head': '<scopecontent><head>#',\n",
-    " 'scope-content_body': '<scopecontent><p>#', \n",
-    " 'num_allegati': '<num>#'})\n",
-    "\n",
-    "# e12b 'lista merci'\n",
-    "itemHeader.update({'lista': '<list>#'})\n",
-    "\n",
-    "# e13 Origin\n",
-    "itemHeader.update({'origine': '<origination label=#1>#2, #1 - #2'})\n",
-    "\n",
-    "# e14 Company name\n",
-    "itemHeader.update({'compagnia': '<corpname>#'})\n",
-    "\n",
-    "# e15 Subject\n",
-    "itemHeader.update({'soggetto': '<subject>#'})\n",
-    "itemHeader.update({'tipologia_soggetto': '<emph>#'})\n",
-    "\n",
-    "# e16 Person + role\n",
-    "itemHeader.update(\n",
-    "{'persona_tenutario': '<persname role=\"tenutario\">#', \n",
-    " 'persona_destinatario': '<persname role=\"destinatario\">#',\n",
-    " 'persona_mittente': '<persname role=\"mittente\">#',\n",
-    " 'persona_indirizzata': '<persname role=\"indirizzata\">#',\n",
-    " 'persona_mano': '<persname role=\"mano\">#',})\n",
-    "\n",
-    "# e17 Dates\n",
-    "itemHeader.update(\n",
-    "{'data_inizio': '<date type=\"inizio\">#', 'data_inizio_note': '<emph>#',\n",
-    " 'data_fine': '<date type=\"fine\">#', 'data_fine_note': '<emph>#',\n",
-    " 'data_chiusura': '<date type=\"chiusura\">#', 'data_chiusura_note': '<emph>#'})\n",
-    "\n",
-    "# e18 Main date: 'periodo'\n",
-    "itemHeader.update({'data_periodo': '<unitdate>#' , 'data_periodo_note': '<unitdate>#'})\n",
-    "\n",
-    "# e19 Location + 'role'\n",
-    "itemHeader.update(\n",
-    "{\"luogo_partenza\": '<geogname role=\"partenza\">#',\n",
-    " \"luogo_arrivo\": '<geogname role=\"arrivo\">#',\n",
-    " \"luogo_luogo\": '<geogname role=\"luogo\">#'})\n",
-    "\n",
-    "# e20 Physical medium\n",
-    "itemHeader.update({'supporto': '<physfacet type=\"supporto\">#'})\n",
-    "\n",
-    "# e21 Physical description\n",
-    "itemHeader.update({'descrizione_fisica': '<physdesc>#'})\n",
-    "itemHeader.update({'numero': '<extent>#'})\n",
-    "# 'container' counts as 'extent' for subseries only\n",
-    "itemHeader.update({'extent': '<container>#'})\n",
-    "itemHeader.update({'genere': '<genreform>#'})\n",
-    "\n",
-    "# e22 phystech\n",
-    "itemHeader.update({'conservazione': '<phystech>#'})\n",
-    "\n",
-    "# e23 Extent\n",
-    "itemHeader.update({'consistenza': '<extent unit=#1>#2, #1: #2'})\n",
-    "\n",
-    "# e24 Notes\n",
-    "itemHeader.update({'nota': '<note>#'})\n",
-    "\n",
-    "# e25 Odd\n",
-    "itemHeader.update({'altre_informazioni': '<odd>#'})\n",
-    "\n",
-    "# e26 Digital objects attached\n",
-    "itemHeader.update({'oggetto_digitale': '<daoloc title=#>'})\n",
-    "\n",
-    "# e0: Parent nodes IDs\n",
-    "itemHeader.update(\n",
-    "{'id_subfonds': '<c level=\"subfonds\" id=#>',\n",
-    " 'id_fonds': '<c level=\"fonds\" id=#>',\n",
-    " 'id_series': '<c level=\"series\" id=#>',\n",
-    " 'id_subseries': '<c level=\"subseries\" id=#>',\n",
-    " 'id_file': '<c level=\"file\" id=#>',\n",
-    " 'id_otherlevel': '<c level=\"otherlevel\" id=#>',\n",
-    " 'id_collection': '<c level=\"collection\" id=#>'})"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "**Our custom functions to extend ElementTree's parsing capabilities**"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 4,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# The traceElems function\n",
-    "def traceElems(node: ET.Element, condition, parents: list = [], coords: list = []):\n",
-    "    res = []\n",
-    "    jj = 0\n",
-    "    for child in node:\n",
-    "        if condition(child):\n",
-    "            res.append({'a_par': parents+[node],\n",
-    "                        'coords': coords+[jj], 'child': child})\n",
-    "        else:\n",
-    "            res = res + traceElems(child, condition, parents+[node], coords+[jj])\n",
-    "        jj = jj+1   \n",
-    "    return res\n",
-    "\n",
-    "# The default function we use as a condition for traceElems: returns 'True' if a node is a 'leaf' (that is, it has no child nodes) or if the node tag is 'c' -- the tag used for the basic items in a collection in the EAD standard.\n",
-    "def isLeafOrC(aa: ET.Element):\n",
-    "    if(aa.tag=='c' or len(aa)==0):\n",
-    "        return True\n",
-    "    else:\n",
-    "        return False"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Extra utilities"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 5,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Some simple utility functions used only for testing\n",
-    "def shownode(node: ET.Element):\n",
-    "    return (node.tag, node.attrib, node.text.replace('\\t','').replace('\\n','').strip() \\\n",
-    "                               if type(node.text) is str else '')\n",
-    "#\n",
-    "def shownodelist(el: ET.Element):\n",
-    "    return list(map(shownode, el))\n",
-    "\n",
-    "\n",
-    "# An extension of the standard str.index method which returns the position index of all elements in the 'lst' argument which are equal to the 'element' argument\n",
-    "def indices(lst, element):\n",
-    "    result = []\n",
-    "    offset = -1\n",
-    "    while True:\n",
-    "        try:\n",
-    "            offset = lst.index(element, offset+1)\n",
-    "        except ValueError:\n",
-    "            return result\n",
-    "        result.append(offset)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Parsing and data processing"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Parse the input file using ElementTree, returning a *root* object, and tracking the elapsed time"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "29.125216960906982\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "treeDatini = ET.parse(import_dir + input_file)\n",
-    "rootDatini = treeDatini.getroot()\n",
-    "\n",
-    "ts2 = datetime.timestamp(datetime.now())\n",
-    "print(ts2 - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Use the *iter* function to track all nodes in the main *root* object having tag **c**; get the **level** attributes of all such nodes; save all different *levels* in the variable **cLevs**"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 7,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "{'otherlevel', 'collection', 'fonds', 'series', 'file', 'subfonds', 'item', 'subseries'}\n"
-     ]
-    }
-   ],
-   "source": [
-    "cLevs = set(map(lambda a : a.attrib['level'], rootDatini.iter('c')))\n",
-    "print(cLevs)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Now we use *traceElems* to record all nodes with tag **c** as well as their parent nodes, organising them according to the value of their **level** attribute; we also print the number of such levels as well as the elapsed time.\n",
-    "\n",
-    "Since by construction *traceElems* doesn't go inside the nodes it returns, this is done in two steps, first collecting top-level **c**-nodes at a given **level**, then iterating through them to find any children with the same tag and attribute inside them."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 8,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "# of \"c\" tags at otherlevellevel, first pass: 10\n",
-      "# of \"c\" tags at collectionlevel, first pass: 1\n",
-      "# of \"c\" tags at fondslevel, first pass: 1\n",
-      "# of \"c\" tags at serieslevel, first pass: 35\n",
-      "# of \"c\" tags at filelevel, first pass: 15449\n",
-      "# of \"c\" tags at subfondslevel, first pass: 14\n",
-      "# of \"c\" tags at itemlevel, first pass: 149085\n",
-      "# of \"c\" tags at subserieslevel, first pass: 1365\n",
-      "\n",
-      "Elapsed time: 8.485028982162476\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "allCs = {}\n",
-    "\n",
-    "for label in cLevs:\n",
-    "    def tempFilt(aa: ET.Element):\n",
-    "        if(aa.tag=='c' and aa.attrib['level']==label):\n",
-    "            return True\n",
-    "        else:\n",
-    "            return False\n",
-    "       \n",
-    "    allCs[label] = traceElems(rootDatini, tempFilt);\n",
-    "    print('# of \"c\" tags at ' + label + 'level, first pass:', len(allCs[label]))\n",
-    "\n",
-    "print()\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Second pass"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 9,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "# of \"c\" tags at otherlevellevel, first pass: 10\n",
-      "# of \"c\" tags at otherlevellevel, total: 10\n",
-      "# of \"c\" tags at collectionlevel, first pass: 1\n",
-      "# of \"c\" tags at collectionlevel, total: 4\n",
-      "# of \"c\" tags at fondslevel, first pass: 1\n",
-      "# of \"c\" tags at fondslevel, total: 1\n",
-      "# of \"c\" tags at serieslevel, first pass: 35\n",
-      "# of \"c\" tags at serieslevel, total: 61\n",
-      "# of \"c\" tags at filelevel, first pass: 15449\n",
-      "# of \"c\" tags at filelevel, total: 15449\n",
-      "# of \"c\" tags at subfondslevel, first pass: 14\n",
-      "# of \"c\" tags at subfondslevel, total: 14\n",
-      "# of \"c\" tags at itemlevel, first pass: 149085\n",
-      "# of \"c\" tags at itemlevel, total: 149085\n",
-      "# of \"c\" tags at subserieslevel, first pass: 1365\n",
-      "# of \"c\" tags at subserieslevel, total: 1477\n",
-      "\n",
-      "Elapsed time: 20.097159147262573\n"
-     ]
-    }
-   ],
-   "source": [
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "allCs2 = {}\n",
-    "\n",
-    "for label in cLevs:\n",
-    "    partial = allCs[label]\n",
-    "    print('# of \"c\" tags at ' + label + 'level, first pass:', len(partial))\n",
-    "    allCs2[label] = partial\n",
-    "    partialUpdate = []\n",
-    "    while True:\n",
-    "        def tempFilt(aa: ET.Element):\n",
-    "            if(aa.tag=='c' and aa.attrib['level']==label):\n",
-    "                 return True\n",
-    "            else:\n",
-    "                 return False\n",
-    "        for node in partial:\n",
-    "            partialUpdate = partialUpdate + traceElems(node['child'], tempFilt)\n",
-    "        #print(len(partialUpdate))\n",
-    "        partial = partialUpdate\n",
-    "        if(len(partialUpdate)==0):\n",
-    "            break\n",
-    "        allCs2[label] = allCs2[label] + partial\n",
-    "        partialUpdate = []\n",
-    "\n",
-    "    print('# of \"c\" tags at ' + label + 'level, total:', len(allCs2[label]))\n",
-    "\n",
-    "print()\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Now it is easy to visualise/retrieve all information stored in **c** nodes, at any level, including their parent nodes and their location in the tree.\n",
-    "\n",
-    "An example (which can be easily tuned by changing the values of local variables, particularly **ii** and **level**), is given in next cell."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 10,
-   "metadata": {
-    "tags": []
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Level: otherlevel\n",
-      "#: 1\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('did', {}, '')]\n",
-      "[0, 0]\n",
-      "('unittitle', {'encodinganalog': 'ISAD 1 - 2 title'}, 'Busta 1167')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('processinfo', {}, ''), ('list', {}, ''), ('item', {}, '')]\n",
-      "[1, 0, 0, 0]\n",
-      "('date', {}, '19/03/2013')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('processinfo', {}, ''), ('list', {}, ''), ('item', {}, '')]\n",
-      "[1, 0, 0, 1]\n",
-      "('persname', {}, 'Admin xDams - open source')\n",
-      "# of children: 0\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 0]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164307', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 1]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164308', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 2]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164309', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 3]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164310', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 4]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164311', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 5]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164312', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 6]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164313', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 7]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164314', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 8]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164315', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 9]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164316', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 10]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164317', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 11]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164318', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 12]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164319', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 13]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164320', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 14]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164321', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 15]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164322', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 16]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164323', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 17]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164324', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 18]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164325', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 19]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164326', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 20]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164327', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 21]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164328', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 22]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164329', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 23]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164330', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 24]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164331', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 25]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164332', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 26]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164333', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 27]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164334', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 28]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164335', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 29]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164336', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 30]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164337', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 31]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164338', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 32]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164339', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 33]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164340', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 34]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164341', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 35]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164342', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 36]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164343', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 37]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164344', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 38]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164345', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 39]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164346', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 40]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164347', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 41]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164348', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 42]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164349', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 43]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164350', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 44]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164351', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 45]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164352', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 46]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164353', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 47]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164354', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 48]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164355', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 49]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164356', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 50]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164357', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 51]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164358', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 52]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164359', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 53]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164360', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 54]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164361', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 55]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164362', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 56]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164363', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 57]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164364', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 58]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164365', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 59]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164366', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 60]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164367', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 61]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164368', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 62]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164369', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 63]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164370', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 64]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164371', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 65]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164372', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 66]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164373', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 67]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164374', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 68]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164375', 'level': 'item'}, '')\n",
-      "# of children: 3\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 69]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164376', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 70]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164377', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 71]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164378', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 72]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164379', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 73]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164380', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 74]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164381', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 75]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164382', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 76]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164383', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 77]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164384', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 78]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164385', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 79]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164386', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 80]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164387', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 81]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164388', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 82]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164389', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 83]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164390', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 84]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164391', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 85]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164392', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 86]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164393', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 87]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164394', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 88]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164395', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 89]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164396', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 90]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164397', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 91]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164398', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 92]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164399', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 93]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164400', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 94]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164401', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 95]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164402', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 96]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164403', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 97]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164404', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 98]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164405', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 99]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164406', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 100]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164407', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 101]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164408', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 102]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164409', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 103]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164410', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 104]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164411', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 105]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164412', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 106]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164413', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 107]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164414', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 108]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164415', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 109]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164416', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 110]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164417', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 111]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164418', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 112]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164419', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 113]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164420', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 114]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164421', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 115]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164422', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 116]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164423', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 117]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164424', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 118]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164425', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 119]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164426', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 120]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164427', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 121]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164428', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 122]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164429', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 123]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164430', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 124]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164431', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 125]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164432', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 126]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164433', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 127]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164434', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 128]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164435', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 129]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164436', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 130]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164437', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 131]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164438', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 132]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164439', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 133]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164440', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 134]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164441', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 135]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164442', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 136]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164443', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 137]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164444', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 138]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164445', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 139]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164446', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 140]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164447', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 141]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164448', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 142]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164449', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 143]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164450', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 144]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164451', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 145]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164452', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 146]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164453', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 147]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164454', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 148]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164455', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 149]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164456', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 150]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164457', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 151]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164458', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 152]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164459', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 153]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164460', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 154]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164461', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 155]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164462', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 156]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164463', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 157]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164464', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 158]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164465', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 159]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164466', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 160]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164467', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 161]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164468', 'level': 'item'}, '')\n",
-      "# of children: 4\n",
-      "\n",
-      "[('c', {'audience': 'internal', 'id': 'ASPO00164306', 'level': 'otherlevel', 'otherlevel': 'container'}, ''), ('dsc', {}, '')]\n",
-      "[2, 162]\n",
-      "('c', {'audience': 'internal', 'id': 'ASPO00164469', 'level': 'item'}, '')\n",
-      "# of children: 5\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "ii = 1\n",
-    "level = 'otherlevel'\n",
-    "test = allCs2[level][ii]\n",
-    "toProc = traceElems(test['child'], isLeafOrC)\n",
-    "\n",
-    "# Comment/uncomment to print info here / on a text file\n",
-    "# (also comment/uncomment the last two lines of this cell)\n",
-    "#testFileName = 'info.txt'\n",
-    "#orig_stdout = sys.stdout\n",
-    "#fp = open(export_dir + testFileName, 'w')\n",
-    "#sys.stdout = fp\n",
-    "#\n",
-    "\n",
-    "print('Level:', level)\n",
-    "print('#:', ii)\n",
-    "print()\n",
-    "for node in toProc:\n",
-    "    print(shownodelist(node['a_par']))\n",
-    "    print(node['coords'])\n",
-    "    print(shownode(node['child']))\n",
-    "    print('# of children:', len(node['child']))\n",
-    "    print()\n",
-    "\n",
-    "\n",
-    "# Comment/uncomment to print info here / on a text file\n",
-    "#sys.stdout = orig_stdout\n",
-    "#fp.close()"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "Test the translator function on a single **c** node"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 11,
-   "metadata": {
-    "scrolled": true
-   },
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "148225\n",
-      "\n",
-      "id_fonds: ASPO00000000\n",
-      "\n",
-      "id_collection: ASPO00164879\n",
-      "\n",
-      "id_otherlevel: ASPO00165135\n",
-      "\n",
-      "id: ASPO00165216\n",
-      "\n",
-      "audience: internal\n",
-      "\n",
-      "oggetto_digitale: AS000162002.jpg | AS000162001.jpg\n",
-      "\n",
-      "segnatura_busta: 1173\n",
-      "\n",
-      "tipologia: documenti diversi\n",
-      "\n",
-      "origine: Fondaco: FIRENZE\n",
-      "\n",
-      "supporto: CARTACEO\n",
-      "\n",
-      "segnatura_codice: 1620\n",
-      "\n",
-      "titolo_aspo: CAMPIONE DI STOFFE\n",
-      "\n",
-      "soggetto: CAMPIONE DI STOFFE\n",
-      "\n",
-      "nota: CAMPIONE DI STOFFE. SI TRATTA PROBABILMENTE DI UN ALLEGATO DI UN LETTERA DALLA COMP. DATINI DI  BARCELLONA ALLA COMP. DATINI DI FIRENZE (1402 O 1403). EDITO IN F. MELIS,dOCUMENTI PER LA STORIA ECONOMICA MEDIEVALE, P. 288.\n",
-      "\n",
-      "scope-content_body: INDICAZIONE DEI COLORI DI PANNO LANA RICHIESTI SULLA PIAZZA DI BARCELLONA CON CUCITE 4 STRISCE DI TESSUTO NEI COLORI PAONAZZO, VERDE, CILISTRINO E SCARLATTO.\n",
-      "\n"
-     ]
-    }
-   ],
-   "source": [
-    "jj = randint(0, len(allCs2['item']))\n",
-    "jj = 148225\n",
-    "print(jj)\n",
-    "print()\n",
-    "\n",
-    "test = allCs2['item'][jj]\n",
-    "toShow = translator(test)\n",
-    "for key in toShow.keys():\n",
-    "    print(key + ': ' + str(toShow[key]))\n",
-    "    print()"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "# Export\n",
-    "\n",
-    "We are now ready to produce the output csv file. We will output one csv for each level, starting from the main level, *item*."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 12,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 53.15745806694031\n"
-     ]
-    }
-   ],
-   "source": [
-    "# Do it! CSV export - 'item' level.\n",
-    "\n",
-    "levelName = 'item'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "# Open output file\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    # Define the writer class for the export\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(itemHeader.keys()))\n",
-    "    # Write the header\n",
-    "    writer.writeheader()\n",
-    "    # Write the second line -- a customised 'comment line'\n",
-    "    writer.writerow(itemHeader)\n",
-    "    # Loop on items\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "metadata": {},
-   "source": [
-    "## Other levels\n",
-    "\n",
-    "Levels different from *item* generally have less entries. To avoid having several blank columns in the csv, we reduce the orderedDict containing the headers before producing the file."
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 13,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.9894499778747559\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'subseries'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 14,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.09115099906921387\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'series'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 15,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.02820587158203125\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'subfonds'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 16,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.0014050006866455078\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'fonds'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 17,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 6.502624988555908\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'file'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 18,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.0023720264434814453\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'collection'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 19,
-   "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Elapsed time: 0.0679769515991211\n"
-     ]
-    }
-   ],
-   "source": [
-    "levelName = 'otherlevel'\n",
-    "\n",
-    "ts1 = datetime.timestamp(datetime.now())\n",
-    "\n",
-    "localKeys = set()\n",
-    "for ii in range(len(allCs2[levelName])):\n",
-    "    test = allCs2[levelName][ii]\n",
-    "    localKeys = localKeys.union( translator(test).keys() )\n",
-    "\n",
-    "localHeader = OrderedDict()\n",
-    "for key in itemHeader:\n",
-    "    if(key in localKeys):\n",
-    "        localHeader[key] = itemHeader[key]\n",
-    "\n",
-    "\n",
-    "\n",
-    "with open(export_dir + \"data_\" + levelName + \".csv\", \"w\", newline=\"\") as csv_file:\n",
-    "    writer = csv.DictWriter(csv_file, fieldnames=list(localHeader.keys()))\n",
-    "    writer.writeheader()\n",
-    "    writer.writerow(localHeader)\n",
-    "    for ii in range(len(allCs2[levelName])):\n",
-    "        test = allCs2[levelName][ii]\n",
-    "        writer.writerow(translator(test))\n",
-    "\n",
-    "print('Elapsed time:', datetime.timestamp(datetime.now()) - ts1)"
-   ]
-  }
- ],
- "metadata": {
-  "interpreter": {
-   "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-  },
-  "kernelspec": {
-   "display_name": "Python 3",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.6.9"
-  },
-  "metadata": {
-   "interpreter": {
-    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
-   }
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 4
-}

+ 0 - 1
tempWork/Readme.txt

@@ -1 +0,0 @@
-Uso questo folder per lavorare con Sage, dato che si crea i suoi checkpoints che non voglio nella repo git.