docs: def an_text_url(identifiant, code):
      """
      Port of the PHP function used by the National Assembly:
  
      public function urlOpaque($identifiant, $codeType = NULL)
      {
          $datas = array(
              'PRJL' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => ''),
              'PION' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
              'PNRECOMENQ' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
              'PNREAPPART341' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
              'PNREMODREGLTAN' => array('repertoire' => 'propositions', 'prefixe' => 'pion', 'suffixe' => ''),
              'AVCE' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ace'),
              'ETDI' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ei'),
              'ACIN' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-ai'),
              'LETT' => array('repertoire' => 'projets', 'prefixe' => 'pl', 'suffixe' => '-l'),
              'PNRETVXINSTITEUROP' => array('repertoire' => 'europe/resolutions', 'prefixe' => 'ppe', 'suffixe' => ''),
              'PNRE' => array('repertoire' => 'europe/resolutions', 'prefixe' => 'ppe', 'suffixe' => ''),
              'RION' => array('repertoire' => '', 'prefixe' => '', 'suffixe' => ''),
              'TCOM' => array('repertoire' => 'ta-commission', 'prefixe' => 'r', 'suffixe' => '-a0'),
              'TCOMMODREGLTAN' => array('repertoire' => 'ta-commission', 'prefixe' => 'r', 'suffixe' => '-a0'),
              'TCOMTVXINSTITEUROP' => array('repertoire' => 'ta-commission', 'prefixe' => 'r', 'suffixe' => '-a0'),
              'TCOMCOMENQ' => array('repertoire' => 'ta-commission', 'prefixe' => 'r', 'suffixe' => '-a0'),
              'TADO' => array('repertoire' => 'ta', 'prefixe' => 'ta', 'suffixe' => ''),
          );
          preg_match('/(.{4})([ANS]*)(R[0-9])([LS]*)([0-9]*)([BTACP]*)(.*)/', $identifiant, $matches);
          $leg = $matches[5];
          $typeTa = $matches[6];
          $num = $matches[7];
          switch ($typeTa) {
              case 'BTC':
                  $type = 'TCOM';
                  break;
              case 'BTA':
                  $type = 'TADO';
                  break;
              default:
                  $type = $codeType;
          }
          $host = "http://www.assemblee-nationale.fr/";
          return $host . $leg . "/" . $datas[$type]['repertoire'] . "/" . $datas[$type]['prefixe'] . $num . $datas[$type]['suffixe'] . ".pdf";
      }
      """
      datas = {
          'PRJL': {
              'repertoire': 'projets',
              'prefixe': 'pl',
              'suffixe': '',
          },
          'PION': {
              'repertoire': 'propositions',
              'prefixe': 'pion',
              'suffixe': '',
          },
          'PNRECOMENQ': {
              'repertoire': 'propositions',
              'prefixe': 'pion',
              'suffixe': '',
          },
          'PNREAPPART341': {
              'repertoire': 'propositions',
              'prefixe': 'pion',
              'suffixe': '',
          },
          'PNREMODREGLTAN': {
              'repertoire': 'propositions',
              'prefixe': 'pion',
              'suffixe': '',
          },
          'AVCE': {
              'repertoire': 'projets',
              'prefixe': 'pl',
              'suffixe': '-ace',
          },
          'ETDI': {
              'repertoire': 'projets',
              'prefixe': 'pl',
              'suffixe': '-ei',
          },
          'ACIN': {
              'repertoire': 'projets',
              'prefixe': 'pl',
              'suffixe': '-ai',
          },
          'LETT': {
              'repertoire': 'projets',
              'prefixe': 'pl',
              'suffixe': '-l',
          },
          'PNRETVXINSTITEUROP': {
              'repertoire': 'europe/resolutions',
              'prefixe': 'ppe',
              'suffixe': '',
          },
          'PNRE': {
              'repertoire': 'propositions',
              'prefixe': 'pion',
              'suffixe': '',
          },
          'RION': {
              'repertoire': '',
              'prefixe': '',
              'suffixe': '',
          },
          'TCOM': {
              'repertoire': 'ta-commission',
              'prefixe': 'r',
              'suffixe': '-a0',
          },
          'TCOMMODREGLTAN': {
              'repertoire': 'ta-commission',
              'prefixe': 'r',
              'suffixe': '-a0',
          },
          'TCOMTVXINSTITEUROP': {
              'repertoire': 'ta-commission',
              'prefixe': 'r',
              'suffixe': '-a0',
          },
          'TCOMCOMENQ': {
              'repertoire': 'ta-commission',
              'prefixe': 'r',
              'suffixe': '-a0',
          },
          'TADO': {
              'repertoire': 'ta',
              'prefixe': 'ta',
              'suffixe': '',
          },
          # NOT IN NATIONAL ASSEMBLY PHP CODE
          'RAPP': {
              'repertoire': 'rapports',
              'prefixe': 'r',
              'suffixe': '',
          },
          'RINF': {
              'repertoire': 'rapports',
              'prefixe': 'r',
              'suffixe': '',
          }
      }
      match = re.match(r'(.{4})([ANS]*)(R[0-9])([LS]*)([0-9]*)([BTACP]*)(.*)', identifiant)
      leg = match.group(5)
      typeTa = match.group(6)
      num = match.group(7)
      if typeTa == 'BTC':
          type = 'TCOM'
      elif typeTa == 'BTA':
          type = 'TADO'
      else:
          type = code
      host = "http://www.assemblee-nationale.fr/"
  
      if type not in datas:
          # ex: ALCNANR5L15B0002 (allocution du président)
          raise Exception('Unknown document type for %s' % identifiant)
  
      return host + leg + "/" + datas[type]['repertoire'] + "/" + datas[type]['prefixe'] + num + datas[type]['suffixe'] + ".asp"