]> asedeno.scripts.mit.edu Git - youtube-dl.git/blob - youtube_dl/compat.py
Try for timestamp, description from window.__INITIAL_DATA__ pages
[youtube-dl.git] / youtube_dl / compat.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import base64
5 import binascii
6 import collections
7 import ctypes
8 import email
9 import getpass
10 import io
11 import itertools
12 import optparse
13 import os
14 import platform
15 import re
16 import shlex
17 import shutil
18 import socket
19 import struct
20 import subprocess
21 import sys
22 import xml.etree.ElementTree
23
24 try:
25     import collections.abc as compat_collections_abc
26 except ImportError:
27     import collections as compat_collections_abc
28
29 try:
30     import urllib.request as compat_urllib_request
31 except ImportError:  # Python 2
32     import urllib2 as compat_urllib_request
33
34 try:
35     import urllib.error as compat_urllib_error
36 except ImportError:  # Python 2
37     import urllib2 as compat_urllib_error
38
39 try:
40     import urllib.parse as compat_urllib_parse
41 except ImportError:  # Python 2
42     import urllib as compat_urllib_parse
43
44 try:
45     from urllib.parse import urlparse as compat_urllib_parse_urlparse
46 except ImportError:  # Python 2
47     from urlparse import urlparse as compat_urllib_parse_urlparse
48
49 try:
50     import urllib.parse as compat_urlparse
51 except ImportError:  # Python 2
52     import urlparse as compat_urlparse
53
54 try:
55     import urllib.response as compat_urllib_response
56 except ImportError:  # Python 2
57     import urllib as compat_urllib_response
58
59 try:
60     import http.cookiejar as compat_cookiejar
61 except ImportError:  # Python 2
62     import cookielib as compat_cookiejar
63
64 if sys.version_info[0] == 2:
65     class compat_cookiejar_Cookie(compat_cookiejar.Cookie):
66         def __init__(self, version, name, value, *args, **kwargs):
67             if isinstance(name, compat_str):
68                 name = name.encode()
69             if isinstance(value, compat_str):
70                 value = value.encode()
71             compat_cookiejar.Cookie.__init__(self, version, name, value, *args, **kwargs)
72 else:
73     compat_cookiejar_Cookie = compat_cookiejar.Cookie
74
75 try:
76     import http.cookies as compat_cookies
77 except ImportError:  # Python 2
78     import Cookie as compat_cookies
79
80 if sys.version_info[0] == 2:
81     class compat_cookies_SimpleCookie(compat_cookies.SimpleCookie):
82         def load(self, rawdata):
83             if isinstance(rawdata, compat_str):
84                 rawdata = str(rawdata)
85             return super(compat_cookies_SimpleCookie, self).load(rawdata)
86 else:
87     compat_cookies_SimpleCookie = compat_cookies.SimpleCookie
88
89 try:
90     import html.entities as compat_html_entities
91 except ImportError:  # Python 2
92     import htmlentitydefs as compat_html_entities
93
94 try:  # Python >= 3.3
95     compat_html_entities_html5 = compat_html_entities.html5
96 except AttributeError:
97     # Copied from CPython 3.5.1 html/entities.py
98     compat_html_entities_html5 = {
99         'Aacute': '\xc1',
100         'aacute': '\xe1',
101         'Aacute;': '\xc1',
102         'aacute;': '\xe1',
103         'Abreve;': '\u0102',
104         'abreve;': '\u0103',
105         'ac;': '\u223e',
106         'acd;': '\u223f',
107         'acE;': '\u223e\u0333',
108         'Acirc': '\xc2',
109         'acirc': '\xe2',
110         'Acirc;': '\xc2',
111         'acirc;': '\xe2',
112         'acute': '\xb4',
113         'acute;': '\xb4',
114         'Acy;': '\u0410',
115         'acy;': '\u0430',
116         'AElig': '\xc6',
117         'aelig': '\xe6',
118         'AElig;': '\xc6',
119         'aelig;': '\xe6',
120         'af;': '\u2061',
121         'Afr;': '\U0001d504',
122         'afr;': '\U0001d51e',
123         'Agrave': '\xc0',
124         'agrave': '\xe0',
125         'Agrave;': '\xc0',
126         'agrave;': '\xe0',
127         'alefsym;': '\u2135',
128         'aleph;': '\u2135',
129         'Alpha;': '\u0391',
130         'alpha;': '\u03b1',
131         'Amacr;': '\u0100',
132         'amacr;': '\u0101',
133         'amalg;': '\u2a3f',
134         'AMP': '&',
135         'amp': '&',
136         'AMP;': '&',
137         'amp;': '&',
138         'And;': '\u2a53',
139         'and;': '\u2227',
140         'andand;': '\u2a55',
141         'andd;': '\u2a5c',
142         'andslope;': '\u2a58',
143         'andv;': '\u2a5a',
144         'ang;': '\u2220',
145         'ange;': '\u29a4',
146         'angle;': '\u2220',
147         'angmsd;': '\u2221',
148         'angmsdaa;': '\u29a8',
149         'angmsdab;': '\u29a9',
150         'angmsdac;': '\u29aa',
151         'angmsdad;': '\u29ab',
152         'angmsdae;': '\u29ac',
153         'angmsdaf;': '\u29ad',
154         'angmsdag;': '\u29ae',
155         'angmsdah;': '\u29af',
156         'angrt;': '\u221f',
157         'angrtvb;': '\u22be',
158         'angrtvbd;': '\u299d',
159         'angsph;': '\u2222',
160         'angst;': '\xc5',
161         'angzarr;': '\u237c',
162         'Aogon;': '\u0104',
163         'aogon;': '\u0105',
164         'Aopf;': '\U0001d538',
165         'aopf;': '\U0001d552',
166         'ap;': '\u2248',
167         'apacir;': '\u2a6f',
168         'apE;': '\u2a70',
169         'ape;': '\u224a',
170         'apid;': '\u224b',
171         'apos;': "'",
172         'ApplyFunction;': '\u2061',
173         'approx;': '\u2248',
174         'approxeq;': '\u224a',
175         'Aring': '\xc5',
176         'aring': '\xe5',
177         'Aring;': '\xc5',
178         'aring;': '\xe5',
179         'Ascr;': '\U0001d49c',
180         'ascr;': '\U0001d4b6',
181         'Assign;': '\u2254',
182         'ast;': '*',
183         'asymp;': '\u2248',
184         'asympeq;': '\u224d',
185         'Atilde': '\xc3',
186         'atilde': '\xe3',
187         'Atilde;': '\xc3',
188         'atilde;': '\xe3',
189         'Auml': '\xc4',
190         'auml': '\xe4',
191         'Auml;': '\xc4',
192         'auml;': '\xe4',
193         'awconint;': '\u2233',
194         'awint;': '\u2a11',
195         'backcong;': '\u224c',
196         'backepsilon;': '\u03f6',
197         'backprime;': '\u2035',
198         'backsim;': '\u223d',
199         'backsimeq;': '\u22cd',
200         'Backslash;': '\u2216',
201         'Barv;': '\u2ae7',
202         'barvee;': '\u22bd',
203         'Barwed;': '\u2306',
204         'barwed;': '\u2305',
205         'barwedge;': '\u2305',
206         'bbrk;': '\u23b5',
207         'bbrktbrk;': '\u23b6',
208         'bcong;': '\u224c',
209         'Bcy;': '\u0411',
210         'bcy;': '\u0431',
211         'bdquo;': '\u201e',
212         'becaus;': '\u2235',
213         'Because;': '\u2235',
214         'because;': '\u2235',
215         'bemptyv;': '\u29b0',
216         'bepsi;': '\u03f6',
217         'bernou;': '\u212c',
218         'Bernoullis;': '\u212c',
219         'Beta;': '\u0392',
220         'beta;': '\u03b2',
221         'beth;': '\u2136',
222         'between;': '\u226c',
223         'Bfr;': '\U0001d505',
224         'bfr;': '\U0001d51f',
225         'bigcap;': '\u22c2',
226         'bigcirc;': '\u25ef',
227         'bigcup;': '\u22c3',
228         'bigodot;': '\u2a00',
229         'bigoplus;': '\u2a01',
230         'bigotimes;': '\u2a02',
231         'bigsqcup;': '\u2a06',
232         'bigstar;': '\u2605',
233         'bigtriangledown;': '\u25bd',
234         'bigtriangleup;': '\u25b3',
235         'biguplus;': '\u2a04',
236         'bigvee;': '\u22c1',
237         'bigwedge;': '\u22c0',
238         'bkarow;': '\u290d',
239         'blacklozenge;': '\u29eb',
240         'blacksquare;': '\u25aa',
241         'blacktriangle;': '\u25b4',
242         'blacktriangledown;': '\u25be',
243         'blacktriangleleft;': '\u25c2',
244         'blacktriangleright;': '\u25b8',
245         'blank;': '\u2423',
246         'blk12;': '\u2592',
247         'blk14;': '\u2591',
248         'blk34;': '\u2593',
249         'block;': '\u2588',
250         'bne;': '=\u20e5',
251         'bnequiv;': '\u2261\u20e5',
252         'bNot;': '\u2aed',
253         'bnot;': '\u2310',
254         'Bopf;': '\U0001d539',
255         'bopf;': '\U0001d553',
256         'bot;': '\u22a5',
257         'bottom;': '\u22a5',
258         'bowtie;': '\u22c8',
259         'boxbox;': '\u29c9',
260         'boxDL;': '\u2557',
261         'boxDl;': '\u2556',
262         'boxdL;': '\u2555',
263         'boxdl;': '\u2510',
264         'boxDR;': '\u2554',
265         'boxDr;': '\u2553',
266         'boxdR;': '\u2552',
267         'boxdr;': '\u250c',
268         'boxH;': '\u2550',
269         'boxh;': '\u2500',
270         'boxHD;': '\u2566',
271         'boxHd;': '\u2564',
272         'boxhD;': '\u2565',
273         'boxhd;': '\u252c',
274         'boxHU;': '\u2569',
275         'boxHu;': '\u2567',
276         'boxhU;': '\u2568',
277         'boxhu;': '\u2534',
278         'boxminus;': '\u229f',
279         'boxplus;': '\u229e',
280         'boxtimes;': '\u22a0',
281         'boxUL;': '\u255d',
282         'boxUl;': '\u255c',
283         'boxuL;': '\u255b',
284         'boxul;': '\u2518',
285         'boxUR;': '\u255a',
286         'boxUr;': '\u2559',
287         'boxuR;': '\u2558',
288         'boxur;': '\u2514',
289         'boxV;': '\u2551',
290         'boxv;': '\u2502',
291         'boxVH;': '\u256c',
292         'boxVh;': '\u256b',
293         'boxvH;': '\u256a',
294         'boxvh;': '\u253c',
295         'boxVL;': '\u2563',
296         'boxVl;': '\u2562',
297         'boxvL;': '\u2561',
298         'boxvl;': '\u2524',
299         'boxVR;': '\u2560',
300         'boxVr;': '\u255f',
301         'boxvR;': '\u255e',
302         'boxvr;': '\u251c',
303         'bprime;': '\u2035',
304         'Breve;': '\u02d8',
305         'breve;': '\u02d8',
306         'brvbar': '\xa6',
307         'brvbar;': '\xa6',
308         'Bscr;': '\u212c',
309         'bscr;': '\U0001d4b7',
310         'bsemi;': '\u204f',
311         'bsim;': '\u223d',
312         'bsime;': '\u22cd',
313         'bsol;': '\\',
314         'bsolb;': '\u29c5',
315         'bsolhsub;': '\u27c8',
316         'bull;': '\u2022',
317         'bullet;': '\u2022',
318         'bump;': '\u224e',
319         'bumpE;': '\u2aae',
320         'bumpe;': '\u224f',
321         'Bumpeq;': '\u224e',
322         'bumpeq;': '\u224f',
323         'Cacute;': '\u0106',
324         'cacute;': '\u0107',
325         'Cap;': '\u22d2',
326         'cap;': '\u2229',
327         'capand;': '\u2a44',
328         'capbrcup;': '\u2a49',
329         'capcap;': '\u2a4b',
330         'capcup;': '\u2a47',
331         'capdot;': '\u2a40',
332         'CapitalDifferentialD;': '\u2145',
333         'caps;': '\u2229\ufe00',
334         'caret;': '\u2041',
335         'caron;': '\u02c7',
336         'Cayleys;': '\u212d',
337         'ccaps;': '\u2a4d',
338         'Ccaron;': '\u010c',
339         'ccaron;': '\u010d',
340         'Ccedil': '\xc7',
341         'ccedil': '\xe7',
342         'Ccedil;': '\xc7',
343         'ccedil;': '\xe7',
344         'Ccirc;': '\u0108',
345         'ccirc;': '\u0109',
346         'Cconint;': '\u2230',
347         'ccups;': '\u2a4c',
348         'ccupssm;': '\u2a50',
349         'Cdot;': '\u010a',
350         'cdot;': '\u010b',
351         'cedil': '\xb8',
352         'cedil;': '\xb8',
353         'Cedilla;': '\xb8',
354         'cemptyv;': '\u29b2',
355         'cent': '\xa2',
356         'cent;': '\xa2',
357         'CenterDot;': '\xb7',
358         'centerdot;': '\xb7',
359         'Cfr;': '\u212d',
360         'cfr;': '\U0001d520',
361         'CHcy;': '\u0427',
362         'chcy;': '\u0447',
363         'check;': '\u2713',
364         'checkmark;': '\u2713',
365         'Chi;': '\u03a7',
366         'chi;': '\u03c7',
367         'cir;': '\u25cb',
368         'circ;': '\u02c6',
369         'circeq;': '\u2257',
370         'circlearrowleft;': '\u21ba',
371         'circlearrowright;': '\u21bb',
372         'circledast;': '\u229b',
373         'circledcirc;': '\u229a',
374         'circleddash;': '\u229d',
375         'CircleDot;': '\u2299',
376         'circledR;': '\xae',
377         'circledS;': '\u24c8',
378         'CircleMinus;': '\u2296',
379         'CirclePlus;': '\u2295',
380         'CircleTimes;': '\u2297',
381         'cirE;': '\u29c3',
382         'cire;': '\u2257',
383         'cirfnint;': '\u2a10',
384         'cirmid;': '\u2aef',
385         'cirscir;': '\u29c2',
386         'ClockwiseContourIntegral;': '\u2232',
387         'CloseCurlyDoubleQuote;': '\u201d',
388         'CloseCurlyQuote;': '\u2019',
389         'clubs;': '\u2663',
390         'clubsuit;': '\u2663',
391         'Colon;': '\u2237',
392         'colon;': ':',
393         'Colone;': '\u2a74',
394         'colone;': '\u2254',
395         'coloneq;': '\u2254',
396         'comma;': ',',
397         'commat;': '@',
398         'comp;': '\u2201',
399         'compfn;': '\u2218',
400         'complement;': '\u2201',
401         'complexes;': '\u2102',
402         'cong;': '\u2245',
403         'congdot;': '\u2a6d',
404         'Congruent;': '\u2261',
405         'Conint;': '\u222f',
406         'conint;': '\u222e',
407         'ContourIntegral;': '\u222e',
408         'Copf;': '\u2102',
409         'copf;': '\U0001d554',
410         'coprod;': '\u2210',
411         'Coproduct;': '\u2210',
412         'COPY': '\xa9',
413         'copy': '\xa9',
414         'COPY;': '\xa9',
415         'copy;': '\xa9',
416         'copysr;': '\u2117',
417         'CounterClockwiseContourIntegral;': '\u2233',
418         'crarr;': '\u21b5',
419         'Cross;': '\u2a2f',
420         'cross;': '\u2717',
421         'Cscr;': '\U0001d49e',
422         'cscr;': '\U0001d4b8',
423         'csub;': '\u2acf',
424         'csube;': '\u2ad1',
425         'csup;': '\u2ad0',
426         'csupe;': '\u2ad2',
427         'ctdot;': '\u22ef',
428         'cudarrl;': '\u2938',
429         'cudarrr;': '\u2935',
430         'cuepr;': '\u22de',
431         'cuesc;': '\u22df',
432         'cularr;': '\u21b6',
433         'cularrp;': '\u293d',
434         'Cup;': '\u22d3',
435         'cup;': '\u222a',
436         'cupbrcap;': '\u2a48',
437         'CupCap;': '\u224d',
438         'cupcap;': '\u2a46',
439         'cupcup;': '\u2a4a',
440         'cupdot;': '\u228d',
441         'cupor;': '\u2a45',
442         'cups;': '\u222a\ufe00',
443         'curarr;': '\u21b7',
444         'curarrm;': '\u293c',
445         'curlyeqprec;': '\u22de',
446         'curlyeqsucc;': '\u22df',
447         'curlyvee;': '\u22ce',
448         'curlywedge;': '\u22cf',
449         'curren': '\xa4',
450         'curren;': '\xa4',
451         'curvearrowleft;': '\u21b6',
452         'curvearrowright;': '\u21b7',
453         'cuvee;': '\u22ce',
454         'cuwed;': '\u22cf',
455         'cwconint;': '\u2232',
456         'cwint;': '\u2231',
457         'cylcty;': '\u232d',
458         'Dagger;': '\u2021',
459         'dagger;': '\u2020',
460         'daleth;': '\u2138',
461         'Darr;': '\u21a1',
462         'dArr;': '\u21d3',
463         'darr;': '\u2193',
464         'dash;': '\u2010',
465         'Dashv;': '\u2ae4',
466         'dashv;': '\u22a3',
467         'dbkarow;': '\u290f',
468         'dblac;': '\u02dd',
469         'Dcaron;': '\u010e',
470         'dcaron;': '\u010f',
471         'Dcy;': '\u0414',
472         'dcy;': '\u0434',
473         'DD;': '\u2145',
474         'dd;': '\u2146',
475         'ddagger;': '\u2021',
476         'ddarr;': '\u21ca',
477         'DDotrahd;': '\u2911',
478         'ddotseq;': '\u2a77',
479         'deg': '\xb0',
480         'deg;': '\xb0',
481         'Del;': '\u2207',
482         'Delta;': '\u0394',
483         'delta;': '\u03b4',
484         'demptyv;': '\u29b1',
485         'dfisht;': '\u297f',
486         'Dfr;': '\U0001d507',
487         'dfr;': '\U0001d521',
488         'dHar;': '\u2965',
489         'dharl;': '\u21c3',
490         'dharr;': '\u21c2',
491         'DiacriticalAcute;': '\xb4',
492         'DiacriticalDot;': '\u02d9',
493         'DiacriticalDoubleAcute;': '\u02dd',
494         'DiacriticalGrave;': '`',
495         'DiacriticalTilde;': '\u02dc',
496         'diam;': '\u22c4',
497         'Diamond;': '\u22c4',
498         'diamond;': '\u22c4',
499         'diamondsuit;': '\u2666',
500         'diams;': '\u2666',
501         'die;': '\xa8',
502         'DifferentialD;': '\u2146',
503         'digamma;': '\u03dd',
504         'disin;': '\u22f2',
505         'div;': '\xf7',
506         'divide': '\xf7',
507         'divide;': '\xf7',
508         'divideontimes;': '\u22c7',
509         'divonx;': '\u22c7',
510         'DJcy;': '\u0402',
511         'djcy;': '\u0452',
512         'dlcorn;': '\u231e',
513         'dlcrop;': '\u230d',
514         'dollar;': '$',
515         'Dopf;': '\U0001d53b',
516         'dopf;': '\U0001d555',
517         'Dot;': '\xa8',
518         'dot;': '\u02d9',
519         'DotDot;': '\u20dc',
520         'doteq;': '\u2250',
521         'doteqdot;': '\u2251',
522         'DotEqual;': '\u2250',
523         'dotminus;': '\u2238',
524         'dotplus;': '\u2214',
525         'dotsquare;': '\u22a1',
526         'doublebarwedge;': '\u2306',
527         'DoubleContourIntegral;': '\u222f',
528         'DoubleDot;': '\xa8',
529         'DoubleDownArrow;': '\u21d3',
530         'DoubleLeftArrow;': '\u21d0',
531         'DoubleLeftRightArrow;': '\u21d4',
532         'DoubleLeftTee;': '\u2ae4',
533         'DoubleLongLeftArrow;': '\u27f8',
534         'DoubleLongLeftRightArrow;': '\u27fa',
535         'DoubleLongRightArrow;': '\u27f9',
536         'DoubleRightArrow;': '\u21d2',
537         'DoubleRightTee;': '\u22a8',
538         'DoubleUpArrow;': '\u21d1',
539         'DoubleUpDownArrow;': '\u21d5',
540         'DoubleVerticalBar;': '\u2225',
541         'DownArrow;': '\u2193',
542         'Downarrow;': '\u21d3',
543         'downarrow;': '\u2193',
544         'DownArrowBar;': '\u2913',
545         'DownArrowUpArrow;': '\u21f5',
546         'DownBreve;': '\u0311',
547         'downdownarrows;': '\u21ca',
548         'downharpoonleft;': '\u21c3',
549         'downharpoonright;': '\u21c2',
550         'DownLeftRightVector;': '\u2950',
551         'DownLeftTeeVector;': '\u295e',
552         'DownLeftVector;': '\u21bd',
553         'DownLeftVectorBar;': '\u2956',
554         'DownRightTeeVector;': '\u295f',
555         'DownRightVector;': '\u21c1',
556         'DownRightVectorBar;': '\u2957',
557         'DownTee;': '\u22a4',
558         'DownTeeArrow;': '\u21a7',
559         'drbkarow;': '\u2910',
560         'drcorn;': '\u231f',
561         'drcrop;': '\u230c',
562         'Dscr;': '\U0001d49f',
563         'dscr;': '\U0001d4b9',
564         'DScy;': '\u0405',
565         'dscy;': '\u0455',
566         'dsol;': '\u29f6',
567         'Dstrok;': '\u0110',
568         'dstrok;': '\u0111',
569         'dtdot;': '\u22f1',
570         'dtri;': '\u25bf',
571         'dtrif;': '\u25be',
572         'duarr;': '\u21f5',
573         'duhar;': '\u296f',
574         'dwangle;': '\u29a6',
575         'DZcy;': '\u040f',
576         'dzcy;': '\u045f',
577         'dzigrarr;': '\u27ff',
578         'Eacute': '\xc9',
579         'eacute': '\xe9',
580         'Eacute;': '\xc9',
581         'eacute;': '\xe9',
582         'easter;': '\u2a6e',
583         'Ecaron;': '\u011a',
584         'ecaron;': '\u011b',
585         'ecir;': '\u2256',
586         'Ecirc': '\xca',
587         'ecirc': '\xea',
588         'Ecirc;': '\xca',
589         'ecirc;': '\xea',
590         'ecolon;': '\u2255',
591         'Ecy;': '\u042d',
592         'ecy;': '\u044d',
593         'eDDot;': '\u2a77',
594         'Edot;': '\u0116',
595         'eDot;': '\u2251',
596         'edot;': '\u0117',
597         'ee;': '\u2147',
598         'efDot;': '\u2252',
599         'Efr;': '\U0001d508',
600         'efr;': '\U0001d522',
601         'eg;': '\u2a9a',
602         'Egrave': '\xc8',
603         'egrave': '\xe8',
604         'Egrave;': '\xc8',
605         'egrave;': '\xe8',
606         'egs;': '\u2a96',
607         'egsdot;': '\u2a98',
608         'el;': '\u2a99',
609         'Element;': '\u2208',
610         'elinters;': '\u23e7',
611         'ell;': '\u2113',
612         'els;': '\u2a95',
613         'elsdot;': '\u2a97',
614         'Emacr;': '\u0112',
615         'emacr;': '\u0113',
616         'empty;': '\u2205',
617         'emptyset;': '\u2205',
618         'EmptySmallSquare;': '\u25fb',
619         'emptyv;': '\u2205',
620         'EmptyVerySmallSquare;': '\u25ab',
621         'emsp13;': '\u2004',
622         'emsp14;': '\u2005',
623         'emsp;': '\u2003',
624         'ENG;': '\u014a',
625         'eng;': '\u014b',
626         'ensp;': '\u2002',
627         'Eogon;': '\u0118',
628         'eogon;': '\u0119',
629         'Eopf;': '\U0001d53c',
630         'eopf;': '\U0001d556',
631         'epar;': '\u22d5',
632         'eparsl;': '\u29e3',
633         'eplus;': '\u2a71',
634         'epsi;': '\u03b5',
635         'Epsilon;': '\u0395',
636         'epsilon;': '\u03b5',
637         'epsiv;': '\u03f5',
638         'eqcirc;': '\u2256',
639         'eqcolon;': '\u2255',
640         'eqsim;': '\u2242',
641         'eqslantgtr;': '\u2a96',
642         'eqslantless;': '\u2a95',
643         'Equal;': '\u2a75',
644         'equals;': '=',
645         'EqualTilde;': '\u2242',
646         'equest;': '\u225f',
647         'Equilibrium;': '\u21cc',
648         'equiv;': '\u2261',
649         'equivDD;': '\u2a78',
650         'eqvparsl;': '\u29e5',
651         'erarr;': '\u2971',
652         'erDot;': '\u2253',
653         'Escr;': '\u2130',
654         'escr;': '\u212f',
655         'esdot;': '\u2250',
656         'Esim;': '\u2a73',
657         'esim;': '\u2242',
658         'Eta;': '\u0397',
659         'eta;': '\u03b7',
660         'ETH': '\xd0',
661         'eth': '\xf0',
662         'ETH;': '\xd0',
663         'eth;': '\xf0',
664         'Euml': '\xcb',
665         'euml': '\xeb',
666         'Euml;': '\xcb',
667         'euml;': '\xeb',
668         'euro;': '\u20ac',
669         'excl;': '!',
670         'exist;': '\u2203',
671         'Exists;': '\u2203',
672         'expectation;': '\u2130',
673         'ExponentialE;': '\u2147',
674         'exponentiale;': '\u2147',
675         'fallingdotseq;': '\u2252',
676         'Fcy;': '\u0424',
677         'fcy;': '\u0444',
678         'female;': '\u2640',
679         'ffilig;': '\ufb03',
680         'fflig;': '\ufb00',
681         'ffllig;': '\ufb04',
682         'Ffr;': '\U0001d509',
683         'ffr;': '\U0001d523',
684         'filig;': '\ufb01',
685         'FilledSmallSquare;': '\u25fc',
686         'FilledVerySmallSquare;': '\u25aa',
687         'fjlig;': 'fj',
688         'flat;': '\u266d',
689         'fllig;': '\ufb02',
690         'fltns;': '\u25b1',
691         'fnof;': '\u0192',
692         'Fopf;': '\U0001d53d',
693         'fopf;': '\U0001d557',
694         'ForAll;': '\u2200',
695         'forall;': '\u2200',
696         'fork;': '\u22d4',
697         'forkv;': '\u2ad9',
698         'Fouriertrf;': '\u2131',
699         'fpartint;': '\u2a0d',
700         'frac12': '\xbd',
701         'frac12;': '\xbd',
702         'frac13;': '\u2153',
703         'frac14': '\xbc',
704         'frac14;': '\xbc',
705         'frac15;': '\u2155',
706         'frac16;': '\u2159',
707         'frac18;': '\u215b',
708         'frac23;': '\u2154',
709         'frac25;': '\u2156',
710         'frac34': '\xbe',
711         'frac34;': '\xbe',
712         'frac35;': '\u2157',
713         'frac38;': '\u215c',
714         'frac45;': '\u2158',
715         'frac56;': '\u215a',
716         'frac58;': '\u215d',
717         'frac78;': '\u215e',
718         'frasl;': '\u2044',
719         'frown;': '\u2322',
720         'Fscr;': '\u2131',
721         'fscr;': '\U0001d4bb',
722         'gacute;': '\u01f5',
723         'Gamma;': '\u0393',
724         'gamma;': '\u03b3',
725         'Gammad;': '\u03dc',
726         'gammad;': '\u03dd',
727         'gap;': '\u2a86',
728         'Gbreve;': '\u011e',
729         'gbreve;': '\u011f',
730         'Gcedil;': '\u0122',
731         'Gcirc;': '\u011c',
732         'gcirc;': '\u011d',
733         'Gcy;': '\u0413',
734         'gcy;': '\u0433',
735         'Gdot;': '\u0120',
736         'gdot;': '\u0121',
737         'gE;': '\u2267',
738         'ge;': '\u2265',
739         'gEl;': '\u2a8c',
740         'gel;': '\u22db',
741         'geq;': '\u2265',
742         'geqq;': '\u2267',
743         'geqslant;': '\u2a7e',
744         'ges;': '\u2a7e',
745         'gescc;': '\u2aa9',
746         'gesdot;': '\u2a80',
747         'gesdoto;': '\u2a82',
748         'gesdotol;': '\u2a84',
749         'gesl;': '\u22db\ufe00',
750         'gesles;': '\u2a94',
751         'Gfr;': '\U0001d50a',
752         'gfr;': '\U0001d524',
753         'Gg;': '\u22d9',
754         'gg;': '\u226b',
755         'ggg;': '\u22d9',
756         'gimel;': '\u2137',
757         'GJcy;': '\u0403',
758         'gjcy;': '\u0453',
759         'gl;': '\u2277',
760         'gla;': '\u2aa5',
761         'glE;': '\u2a92',
762         'glj;': '\u2aa4',
763         'gnap;': '\u2a8a',
764         'gnapprox;': '\u2a8a',
765         'gnE;': '\u2269',
766         'gne;': '\u2a88',
767         'gneq;': '\u2a88',
768         'gneqq;': '\u2269',
769         'gnsim;': '\u22e7',
770         'Gopf;': '\U0001d53e',
771         'gopf;': '\U0001d558',
772         'grave;': '`',
773         'GreaterEqual;': '\u2265',
774         'GreaterEqualLess;': '\u22db',
775         'GreaterFullEqual;': '\u2267',
776         'GreaterGreater;': '\u2aa2',
777         'GreaterLess;': '\u2277',
778         'GreaterSlantEqual;': '\u2a7e',
779         'GreaterTilde;': '\u2273',
780         'Gscr;': '\U0001d4a2',
781         'gscr;': '\u210a',
782         'gsim;': '\u2273',
783         'gsime;': '\u2a8e',
784         'gsiml;': '\u2a90',
785         'GT': '>',
786         'gt': '>',
787         'GT;': '>',
788         'Gt;': '\u226b',
789         'gt;': '>',
790         'gtcc;': '\u2aa7',
791         'gtcir;': '\u2a7a',
792         'gtdot;': '\u22d7',
793         'gtlPar;': '\u2995',
794         'gtquest;': '\u2a7c',
795         'gtrapprox;': '\u2a86',
796         'gtrarr;': '\u2978',
797         'gtrdot;': '\u22d7',
798         'gtreqless;': '\u22db',
799         'gtreqqless;': '\u2a8c',
800         'gtrless;': '\u2277',
801         'gtrsim;': '\u2273',
802         'gvertneqq;': '\u2269\ufe00',
803         'gvnE;': '\u2269\ufe00',
804         'Hacek;': '\u02c7',
805         'hairsp;': '\u200a',
806         'half;': '\xbd',
807         'hamilt;': '\u210b',
808         'HARDcy;': '\u042a',
809         'hardcy;': '\u044a',
810         'hArr;': '\u21d4',
811         'harr;': '\u2194',
812         'harrcir;': '\u2948',
813         'harrw;': '\u21ad',
814         'Hat;': '^',
815         'hbar;': '\u210f',
816         'Hcirc;': '\u0124',
817         'hcirc;': '\u0125',
818         'hearts;': '\u2665',
819         'heartsuit;': '\u2665',
820         'hellip;': '\u2026',
821         'hercon;': '\u22b9',
822         'Hfr;': '\u210c',
823         'hfr;': '\U0001d525',
824         'HilbertSpace;': '\u210b',
825         'hksearow;': '\u2925',
826         'hkswarow;': '\u2926',
827         'hoarr;': '\u21ff',
828         'homtht;': '\u223b',
829         'hookleftarrow;': '\u21a9',
830         'hookrightarrow;': '\u21aa',
831         'Hopf;': '\u210d',
832         'hopf;': '\U0001d559',
833         'horbar;': '\u2015',
834         'HorizontalLine;': '\u2500',
835         'Hscr;': '\u210b',
836         'hscr;': '\U0001d4bd',
837         'hslash;': '\u210f',
838         'Hstrok;': '\u0126',
839         'hstrok;': '\u0127',
840         'HumpDownHump;': '\u224e',
841         'HumpEqual;': '\u224f',
842         'hybull;': '\u2043',
843         'hyphen;': '\u2010',
844         'Iacute': '\xcd',
845         'iacute': '\xed',
846         'Iacute;': '\xcd',
847         'iacute;': '\xed',
848         'ic;': '\u2063',
849         'Icirc': '\xce',
850         'icirc': '\xee',
851         'Icirc;': '\xce',
852         'icirc;': '\xee',
853         'Icy;': '\u0418',
854         'icy;': '\u0438',
855         'Idot;': '\u0130',
856         'IEcy;': '\u0415',
857         'iecy;': '\u0435',
858         'iexcl': '\xa1',
859         'iexcl;': '\xa1',
860         'iff;': '\u21d4',
861         'Ifr;': '\u2111',
862         'ifr;': '\U0001d526',
863         'Igrave': '\xcc',
864         'igrave': '\xec',
865         'Igrave;': '\xcc',
866         'igrave;': '\xec',
867         'ii;': '\u2148',
868         'iiiint;': '\u2a0c',
869         'iiint;': '\u222d',
870         'iinfin;': '\u29dc',
871         'iiota;': '\u2129',
872         'IJlig;': '\u0132',
873         'ijlig;': '\u0133',
874         'Im;': '\u2111',
875         'Imacr;': '\u012a',
876         'imacr;': '\u012b',
877         'image;': '\u2111',
878         'ImaginaryI;': '\u2148',
879         'imagline;': '\u2110',
880         'imagpart;': '\u2111',
881         'imath;': '\u0131',
882         'imof;': '\u22b7',
883         'imped;': '\u01b5',
884         'Implies;': '\u21d2',
885         'in;': '\u2208',
886         'incare;': '\u2105',
887         'infin;': '\u221e',
888         'infintie;': '\u29dd',
889         'inodot;': '\u0131',
890         'Int;': '\u222c',
891         'int;': '\u222b',
892         'intcal;': '\u22ba',
893         'integers;': '\u2124',
894         'Integral;': '\u222b',
895         'intercal;': '\u22ba',
896         'Intersection;': '\u22c2',
897         'intlarhk;': '\u2a17',
898         'intprod;': '\u2a3c',
899         'InvisibleComma;': '\u2063',
900         'InvisibleTimes;': '\u2062',
901         'IOcy;': '\u0401',
902         'iocy;': '\u0451',
903         'Iogon;': '\u012e',
904         'iogon;': '\u012f',
905         'Iopf;': '\U0001d540',
906         'iopf;': '\U0001d55a',
907         'Iota;': '\u0399',
908         'iota;': '\u03b9',
909         'iprod;': '\u2a3c',
910         'iquest': '\xbf',
911         'iquest;': '\xbf',
912         'Iscr;': '\u2110',
913         'iscr;': '\U0001d4be',
914         'isin;': '\u2208',
915         'isindot;': '\u22f5',
916         'isinE;': '\u22f9',
917         'isins;': '\u22f4',
918         'isinsv;': '\u22f3',
919         'isinv;': '\u2208',
920         'it;': '\u2062',
921         'Itilde;': '\u0128',
922         'itilde;': '\u0129',
923         'Iukcy;': '\u0406',
924         'iukcy;': '\u0456',
925         'Iuml': '\xcf',
926         'iuml': '\xef',
927         'Iuml;': '\xcf',
928         'iuml;': '\xef',
929         'Jcirc;': '\u0134',
930         'jcirc;': '\u0135',
931         'Jcy;': '\u0419',
932         'jcy;': '\u0439',
933         'Jfr;': '\U0001d50d',
934         'jfr;': '\U0001d527',
935         'jmath;': '\u0237',
936         'Jopf;': '\U0001d541',
937         'jopf;': '\U0001d55b',
938         'Jscr;': '\U0001d4a5',
939         'jscr;': '\U0001d4bf',
940         'Jsercy;': '\u0408',
941         'jsercy;': '\u0458',
942         'Jukcy;': '\u0404',
943         'jukcy;': '\u0454',
944         'Kappa;': '\u039a',
945         'kappa;': '\u03ba',
946         'kappav;': '\u03f0',
947         'Kcedil;': '\u0136',
948         'kcedil;': '\u0137',
949         'Kcy;': '\u041a',
950         'kcy;': '\u043a',
951         'Kfr;': '\U0001d50e',
952         'kfr;': '\U0001d528',
953         'kgreen;': '\u0138',
954         'KHcy;': '\u0425',
955         'khcy;': '\u0445',
956         'KJcy;': '\u040c',
957         'kjcy;': '\u045c',
958         'Kopf;': '\U0001d542',
959         'kopf;': '\U0001d55c',
960         'Kscr;': '\U0001d4a6',
961         'kscr;': '\U0001d4c0',
962         'lAarr;': '\u21da',
963         'Lacute;': '\u0139',
964         'lacute;': '\u013a',
965         'laemptyv;': '\u29b4',
966         'lagran;': '\u2112',
967         'Lambda;': '\u039b',
968         'lambda;': '\u03bb',
969         'Lang;': '\u27ea',
970         'lang;': '\u27e8',
971         'langd;': '\u2991',
972         'langle;': '\u27e8',
973         'lap;': '\u2a85',
974         'Laplacetrf;': '\u2112',
975         'laquo': '\xab',
976         'laquo;': '\xab',
977         'Larr;': '\u219e',
978         'lArr;': '\u21d0',
979         'larr;': '\u2190',
980         'larrb;': '\u21e4',
981         'larrbfs;': '\u291f',
982         'larrfs;': '\u291d',
983         'larrhk;': '\u21a9',
984         'larrlp;': '\u21ab',
985         'larrpl;': '\u2939',
986         'larrsim;': '\u2973',
987         'larrtl;': '\u21a2',
988         'lat;': '\u2aab',
989         'lAtail;': '\u291b',
990         'latail;': '\u2919',
991         'late;': '\u2aad',
992         'lates;': '\u2aad\ufe00',
993         'lBarr;': '\u290e',
994         'lbarr;': '\u290c',
995         'lbbrk;': '\u2772',
996         'lbrace;': '{',
997         'lbrack;': '[',
998         'lbrke;': '\u298b',
999         'lbrksld;': '\u298f',
1000         'lbrkslu;': '\u298d',
1001         'Lcaron;': '\u013d',
1002         'lcaron;': '\u013e',
1003         'Lcedil;': '\u013b',
1004         'lcedil;': '\u013c',
1005         'lceil;': '\u2308',
1006         'lcub;': '{',
1007         'Lcy;': '\u041b',
1008         'lcy;': '\u043b',
1009         'ldca;': '\u2936',
1010         'ldquo;': '\u201c',
1011         'ldquor;': '\u201e',
1012         'ldrdhar;': '\u2967',
1013         'ldrushar;': '\u294b',
1014         'ldsh;': '\u21b2',
1015         'lE;': '\u2266',
1016         'le;': '\u2264',
1017         'LeftAngleBracket;': '\u27e8',
1018         'LeftArrow;': '\u2190',
1019         'Leftarrow;': '\u21d0',
1020         'leftarrow;': '\u2190',
1021         'LeftArrowBar;': '\u21e4',
1022         'LeftArrowRightArrow;': '\u21c6',
1023         'leftarrowtail;': '\u21a2',
1024         'LeftCeiling;': '\u2308',
1025         'LeftDoubleBracket;': '\u27e6',
1026         'LeftDownTeeVector;': '\u2961',
1027         'LeftDownVector;': '\u21c3',
1028         'LeftDownVectorBar;': '\u2959',
1029         'LeftFloor;': '\u230a',
1030         'leftharpoondown;': '\u21bd',
1031         'leftharpoonup;': '\u21bc',
1032         'leftleftarrows;': '\u21c7',
1033         'LeftRightArrow;': '\u2194',
1034         'Leftrightarrow;': '\u21d4',
1035         'leftrightarrow;': '\u2194',
1036         'leftrightarrows;': '\u21c6',
1037         'leftrightharpoons;': '\u21cb',
1038         'leftrightsquigarrow;': '\u21ad',
1039         'LeftRightVector;': '\u294e',
1040         'LeftTee;': '\u22a3',
1041         'LeftTeeArrow;': '\u21a4',
1042         'LeftTeeVector;': '\u295a',
1043         'leftthreetimes;': '\u22cb',
1044         'LeftTriangle;': '\u22b2',
1045         'LeftTriangleBar;': '\u29cf',
1046         'LeftTriangleEqual;': '\u22b4',
1047         'LeftUpDownVector;': '\u2951',
1048         'LeftUpTeeVector;': '\u2960',
1049         'LeftUpVector;': '\u21bf',
1050         'LeftUpVectorBar;': '\u2958',
1051         'LeftVector;': '\u21bc',
1052         'LeftVectorBar;': '\u2952',
1053         'lEg;': '\u2a8b',
1054         'leg;': '\u22da',
1055         'leq;': '\u2264',
1056         'leqq;': '\u2266',
1057         'leqslant;': '\u2a7d',
1058         'les;': '\u2a7d',
1059         'lescc;': '\u2aa8',
1060         'lesdot;': '\u2a7f',
1061         'lesdoto;': '\u2a81',
1062         'lesdotor;': '\u2a83',
1063         'lesg;': '\u22da\ufe00',
1064         'lesges;': '\u2a93',
1065         'lessapprox;': '\u2a85',
1066         'lessdot;': '\u22d6',
1067         'lesseqgtr;': '\u22da',
1068         'lesseqqgtr;': '\u2a8b',
1069         'LessEqualGreater;': '\u22da',
1070         'LessFullEqual;': '\u2266',
1071         'LessGreater;': '\u2276',
1072         'lessgtr;': '\u2276',
1073         'LessLess;': '\u2aa1',
1074         'lesssim;': '\u2272',
1075         'LessSlantEqual;': '\u2a7d',
1076         'LessTilde;': '\u2272',
1077         'lfisht;': '\u297c',
1078         'lfloor;': '\u230a',
1079         'Lfr;': '\U0001d50f',
1080         'lfr;': '\U0001d529',
1081         'lg;': '\u2276',
1082         'lgE;': '\u2a91',
1083         'lHar;': '\u2962',
1084         'lhard;': '\u21bd',
1085         'lharu;': '\u21bc',
1086         'lharul;': '\u296a',
1087         'lhblk;': '\u2584',
1088         'LJcy;': '\u0409',
1089         'ljcy;': '\u0459',
1090         'Ll;': '\u22d8',
1091         'll;': '\u226a',
1092         'llarr;': '\u21c7',
1093         'llcorner;': '\u231e',
1094         'Lleftarrow;': '\u21da',
1095         'llhard;': '\u296b',
1096         'lltri;': '\u25fa',
1097         'Lmidot;': '\u013f',
1098         'lmidot;': '\u0140',
1099         'lmoust;': '\u23b0',
1100         'lmoustache;': '\u23b0',
1101         'lnap;': '\u2a89',
1102         'lnapprox;': '\u2a89',
1103         'lnE;': '\u2268',
1104         'lne;': '\u2a87',
1105         'lneq;': '\u2a87',
1106         'lneqq;': '\u2268',
1107         'lnsim;': '\u22e6',
1108         'loang;': '\u27ec',
1109         'loarr;': '\u21fd',
1110         'lobrk;': '\u27e6',
1111         'LongLeftArrow;': '\u27f5',
1112         'Longleftarrow;': '\u27f8',
1113         'longleftarrow;': '\u27f5',
1114         'LongLeftRightArrow;': '\u27f7',
1115         'Longleftrightarrow;': '\u27fa',
1116         'longleftrightarrow;': '\u27f7',
1117         'longmapsto;': '\u27fc',
1118         'LongRightArrow;': '\u27f6',
1119         'Longrightarrow;': '\u27f9',
1120         'longrightarrow;': '\u27f6',
1121         'looparrowleft;': '\u21ab',
1122         'looparrowright;': '\u21ac',
1123         'lopar;': '\u2985',
1124         'Lopf;': '\U0001d543',
1125         'lopf;': '\U0001d55d',
1126         'loplus;': '\u2a2d',
1127         'lotimes;': '\u2a34',
1128         'lowast;': '\u2217',
1129         'lowbar;': '_',
1130         'LowerLeftArrow;': '\u2199',
1131         'LowerRightArrow;': '\u2198',
1132         'loz;': '\u25ca',
1133         'lozenge;': '\u25ca',
1134         'lozf;': '\u29eb',
1135         'lpar;': '(',
1136         'lparlt;': '\u2993',
1137         'lrarr;': '\u21c6',
1138         'lrcorner;': '\u231f',
1139         'lrhar;': '\u21cb',
1140         'lrhard;': '\u296d',
1141         'lrm;': '\u200e',
1142         'lrtri;': '\u22bf',
1143         'lsaquo;': '\u2039',
1144         'Lscr;': '\u2112',
1145         'lscr;': '\U0001d4c1',
1146         'Lsh;': '\u21b0',
1147         'lsh;': '\u21b0',
1148         'lsim;': '\u2272',
1149         'lsime;': '\u2a8d',
1150         'lsimg;': '\u2a8f',
1151         'lsqb;': '[',
1152         'lsquo;': '\u2018',
1153         'lsquor;': '\u201a',
1154         'Lstrok;': '\u0141',
1155         'lstrok;': '\u0142',
1156         'LT': '<',
1157         'lt': '<',
1158         'LT;': '<',
1159         'Lt;': '\u226a',
1160         'lt;': '<',
1161         'ltcc;': '\u2aa6',
1162         'ltcir;': '\u2a79',
1163         'ltdot;': '\u22d6',
1164         'lthree;': '\u22cb',
1165         'ltimes;': '\u22c9',
1166         'ltlarr;': '\u2976',
1167         'ltquest;': '\u2a7b',
1168         'ltri;': '\u25c3',
1169         'ltrie;': '\u22b4',
1170         'ltrif;': '\u25c2',
1171         'ltrPar;': '\u2996',
1172         'lurdshar;': '\u294a',
1173         'luruhar;': '\u2966',
1174         'lvertneqq;': '\u2268\ufe00',
1175         'lvnE;': '\u2268\ufe00',
1176         'macr': '\xaf',
1177         'macr;': '\xaf',
1178         'male;': '\u2642',
1179         'malt;': '\u2720',
1180         'maltese;': '\u2720',
1181         'Map;': '\u2905',
1182         'map;': '\u21a6',
1183         'mapsto;': '\u21a6',
1184         'mapstodown;': '\u21a7',
1185         'mapstoleft;': '\u21a4',
1186         'mapstoup;': '\u21a5',
1187         'marker;': '\u25ae',
1188         'mcomma;': '\u2a29',
1189         'Mcy;': '\u041c',
1190         'mcy;': '\u043c',
1191         'mdash;': '\u2014',
1192         'mDDot;': '\u223a',
1193         'measuredangle;': '\u2221',
1194         'MediumSpace;': '\u205f',
1195         'Mellintrf;': '\u2133',
1196         'Mfr;': '\U0001d510',
1197         'mfr;': '\U0001d52a',
1198         'mho;': '\u2127',
1199         'micro': '\xb5',
1200         'micro;': '\xb5',
1201         'mid;': '\u2223',
1202         'midast;': '*',
1203         'midcir;': '\u2af0',
1204         'middot': '\xb7',
1205         'middot;': '\xb7',
1206         'minus;': '\u2212',
1207         'minusb;': '\u229f',
1208         'minusd;': '\u2238',
1209         'minusdu;': '\u2a2a',
1210         'MinusPlus;': '\u2213',
1211         'mlcp;': '\u2adb',
1212         'mldr;': '\u2026',
1213         'mnplus;': '\u2213',
1214         'models;': '\u22a7',
1215         'Mopf;': '\U0001d544',
1216         'mopf;': '\U0001d55e',
1217         'mp;': '\u2213',
1218         'Mscr;': '\u2133',
1219         'mscr;': '\U0001d4c2',
1220         'mstpos;': '\u223e',
1221         'Mu;': '\u039c',
1222         'mu;': '\u03bc',
1223         'multimap;': '\u22b8',
1224         'mumap;': '\u22b8',
1225         'nabla;': '\u2207',
1226         'Nacute;': '\u0143',
1227         'nacute;': '\u0144',
1228         'nang;': '\u2220\u20d2',
1229         'nap;': '\u2249',
1230         'napE;': '\u2a70\u0338',
1231         'napid;': '\u224b\u0338',
1232         'napos;': '\u0149',
1233         'napprox;': '\u2249',
1234         'natur;': '\u266e',
1235         'natural;': '\u266e',
1236         'naturals;': '\u2115',
1237         'nbsp': '\xa0',
1238         'nbsp;': '\xa0',
1239         'nbump;': '\u224e\u0338',
1240         'nbumpe;': '\u224f\u0338',
1241         'ncap;': '\u2a43',
1242         'Ncaron;': '\u0147',
1243         'ncaron;': '\u0148',
1244         'Ncedil;': '\u0145',
1245         'ncedil;': '\u0146',
1246         'ncong;': '\u2247',
1247         'ncongdot;': '\u2a6d\u0338',
1248         'ncup;': '\u2a42',
1249         'Ncy;': '\u041d',
1250         'ncy;': '\u043d',
1251         'ndash;': '\u2013',
1252         'ne;': '\u2260',
1253         'nearhk;': '\u2924',
1254         'neArr;': '\u21d7',
1255         'nearr;': '\u2197',
1256         'nearrow;': '\u2197',
1257         'nedot;': '\u2250\u0338',
1258         'NegativeMediumSpace;': '\u200b',
1259         'NegativeThickSpace;': '\u200b',
1260         'NegativeThinSpace;': '\u200b',
1261         'NegativeVeryThinSpace;': '\u200b',
1262         'nequiv;': '\u2262',
1263         'nesear;': '\u2928',
1264         'nesim;': '\u2242\u0338',
1265         'NestedGreaterGreater;': '\u226b',
1266         'NestedLessLess;': '\u226a',
1267         'NewLine;': '\n',
1268         'nexist;': '\u2204',
1269         'nexists;': '\u2204',
1270         'Nfr;': '\U0001d511',
1271         'nfr;': '\U0001d52b',
1272         'ngE;': '\u2267\u0338',
1273         'nge;': '\u2271',
1274         'ngeq;': '\u2271',
1275         'ngeqq;': '\u2267\u0338',
1276         'ngeqslant;': '\u2a7e\u0338',
1277         'nges;': '\u2a7e\u0338',
1278         'nGg;': '\u22d9\u0338',
1279         'ngsim;': '\u2275',
1280         'nGt;': '\u226b\u20d2',
1281         'ngt;': '\u226f',
1282         'ngtr;': '\u226f',
1283         'nGtv;': '\u226b\u0338',
1284         'nhArr;': '\u21ce',
1285         'nharr;': '\u21ae',
1286         'nhpar;': '\u2af2',
1287         'ni;': '\u220b',
1288         'nis;': '\u22fc',
1289         'nisd;': '\u22fa',
1290         'niv;': '\u220b',
1291         'NJcy;': '\u040a',
1292         'njcy;': '\u045a',
1293         'nlArr;': '\u21cd',
1294         'nlarr;': '\u219a',
1295         'nldr;': '\u2025',
1296         'nlE;': '\u2266\u0338',
1297         'nle;': '\u2270',
1298         'nLeftarrow;': '\u21cd',
1299         'nleftarrow;': '\u219a',
1300         'nLeftrightarrow;': '\u21ce',
1301         'nleftrightarrow;': '\u21ae',
1302         'nleq;': '\u2270',
1303         'nleqq;': '\u2266\u0338',
1304         'nleqslant;': '\u2a7d\u0338',
1305         'nles;': '\u2a7d\u0338',
1306         'nless;': '\u226e',
1307         'nLl;': '\u22d8\u0338',
1308         'nlsim;': '\u2274',
1309         'nLt;': '\u226a\u20d2',
1310         'nlt;': '\u226e',
1311         'nltri;': '\u22ea',
1312         'nltrie;': '\u22ec',
1313         'nLtv;': '\u226a\u0338',
1314         'nmid;': '\u2224',
1315         'NoBreak;': '\u2060',
1316         'NonBreakingSpace;': '\xa0',
1317         'Nopf;': '\u2115',
1318         'nopf;': '\U0001d55f',
1319         'not': '\xac',
1320         'Not;': '\u2aec',
1321         'not;': '\xac',
1322         'NotCongruent;': '\u2262',
1323         'NotCupCap;': '\u226d',
1324         'NotDoubleVerticalBar;': '\u2226',
1325         'NotElement;': '\u2209',
1326         'NotEqual;': '\u2260',
1327         'NotEqualTilde;': '\u2242\u0338',
1328         'NotExists;': '\u2204',
1329         'NotGreater;': '\u226f',
1330         'NotGreaterEqual;': '\u2271',
1331         'NotGreaterFullEqual;': '\u2267\u0338',
1332         'NotGreaterGreater;': '\u226b\u0338',
1333         'NotGreaterLess;': '\u2279',
1334         'NotGreaterSlantEqual;': '\u2a7e\u0338',
1335         'NotGreaterTilde;': '\u2275',
1336         'NotHumpDownHump;': '\u224e\u0338',
1337         'NotHumpEqual;': '\u224f\u0338',
1338         'notin;': '\u2209',
1339         'notindot;': '\u22f5\u0338',
1340         'notinE;': '\u22f9\u0338',
1341         'notinva;': '\u2209',
1342         'notinvb;': '\u22f7',
1343         'notinvc;': '\u22f6',
1344         'NotLeftTriangle;': '\u22ea',
1345         'NotLeftTriangleBar;': '\u29cf\u0338',
1346         'NotLeftTriangleEqual;': '\u22ec',
1347         'NotLess;': '\u226e',
1348         'NotLessEqual;': '\u2270',
1349         'NotLessGreater;': '\u2278',
1350         'NotLessLess;': '\u226a\u0338',
1351         'NotLessSlantEqual;': '\u2a7d\u0338',
1352         'NotLessTilde;': '\u2274',
1353         'NotNestedGreaterGreater;': '\u2aa2\u0338',
1354         'NotNestedLessLess;': '\u2aa1\u0338',
1355         'notni;': '\u220c',
1356         'notniva;': '\u220c',
1357         'notnivb;': '\u22fe',
1358         'notnivc;': '\u22fd',
1359         'NotPrecedes;': '\u2280',
1360         'NotPrecedesEqual;': '\u2aaf\u0338',
1361         'NotPrecedesSlantEqual;': '\u22e0',
1362         'NotReverseElement;': '\u220c',
1363         'NotRightTriangle;': '\u22eb',
1364         'NotRightTriangleBar;': '\u29d0\u0338',
1365         'NotRightTriangleEqual;': '\u22ed',
1366         'NotSquareSubset;': '\u228f\u0338',
1367         'NotSquareSubsetEqual;': '\u22e2',
1368         'NotSquareSuperset;': '\u2290\u0338',
1369         'NotSquareSupersetEqual;': '\u22e3',
1370         'NotSubset;': '\u2282\u20d2',
1371         'NotSubsetEqual;': '\u2288',
1372         'NotSucceeds;': '\u2281',
1373         'NotSucceedsEqual;': '\u2ab0\u0338',
1374         'NotSucceedsSlantEqual;': '\u22e1',
1375         'NotSucceedsTilde;': '\u227f\u0338',
1376         'NotSuperset;': '\u2283\u20d2',
1377         'NotSupersetEqual;': '\u2289',
1378         'NotTilde;': '\u2241',
1379         'NotTildeEqual;': '\u2244',
1380         'NotTildeFullEqual;': '\u2247',
1381         'NotTildeTilde;': '\u2249',
1382         'NotVerticalBar;': '\u2224',
1383         'npar;': '\u2226',
1384         'nparallel;': '\u2226',
1385         'nparsl;': '\u2afd\u20e5',
1386         'npart;': '\u2202\u0338',
1387         'npolint;': '\u2a14',
1388         'npr;': '\u2280',
1389         'nprcue;': '\u22e0',
1390         'npre;': '\u2aaf\u0338',
1391         'nprec;': '\u2280',
1392         'npreceq;': '\u2aaf\u0338',
1393         'nrArr;': '\u21cf',
1394         'nrarr;': '\u219b',
1395         'nrarrc;': '\u2933\u0338',
1396         'nrarrw;': '\u219d\u0338',
1397         'nRightarrow;': '\u21cf',
1398         'nrightarrow;': '\u219b',
1399         'nrtri;': '\u22eb',
1400         'nrtrie;': '\u22ed',
1401         'nsc;': '\u2281',
1402         'nsccue;': '\u22e1',
1403         'nsce;': '\u2ab0\u0338',
1404         'Nscr;': '\U0001d4a9',
1405         'nscr;': '\U0001d4c3',
1406         'nshortmid;': '\u2224',
1407         'nshortparallel;': '\u2226',
1408         'nsim;': '\u2241',
1409         'nsime;': '\u2244',
1410         'nsimeq;': '\u2244',
1411         'nsmid;': '\u2224',
1412         'nspar;': '\u2226',
1413         'nsqsube;': '\u22e2',
1414         'nsqsupe;': '\u22e3',
1415         'nsub;': '\u2284',
1416         'nsubE;': '\u2ac5\u0338',
1417         'nsube;': '\u2288',
1418         'nsubset;': '\u2282\u20d2',
1419         'nsubseteq;': '\u2288',
1420         'nsubseteqq;': '\u2ac5\u0338',
1421         'nsucc;': '\u2281',
1422         'nsucceq;': '\u2ab0\u0338',
1423         'nsup;': '\u2285',
1424         'nsupE;': '\u2ac6\u0338',
1425         'nsupe;': '\u2289',
1426         'nsupset;': '\u2283\u20d2',
1427         'nsupseteq;': '\u2289',
1428         'nsupseteqq;': '\u2ac6\u0338',
1429         'ntgl;': '\u2279',
1430         'Ntilde': '\xd1',
1431         'ntilde': '\xf1',
1432         'Ntilde;': '\xd1',
1433         'ntilde;': '\xf1',
1434         'ntlg;': '\u2278',
1435         'ntriangleleft;': '\u22ea',
1436         'ntrianglelefteq;': '\u22ec',
1437         'ntriangleright;': '\u22eb',
1438         'ntrianglerighteq;': '\u22ed',
1439         'Nu;': '\u039d',
1440         'nu;': '\u03bd',
1441         'num;': '#',
1442         'numero;': '\u2116',
1443         'numsp;': '\u2007',
1444         'nvap;': '\u224d\u20d2',
1445         'nVDash;': '\u22af',
1446         'nVdash;': '\u22ae',
1447         'nvDash;': '\u22ad',
1448         'nvdash;': '\u22ac',
1449         'nvge;': '\u2265\u20d2',
1450         'nvgt;': '>\u20d2',
1451         'nvHarr;': '\u2904',
1452         'nvinfin;': '\u29de',
1453         'nvlArr;': '\u2902',
1454         'nvle;': '\u2264\u20d2',
1455         'nvlt;': '<\u20d2',
1456         'nvltrie;': '\u22b4\u20d2',
1457         'nvrArr;': '\u2903',
1458         'nvrtrie;': '\u22b5\u20d2',
1459         'nvsim;': '\u223c\u20d2',
1460         'nwarhk;': '\u2923',
1461         'nwArr;': '\u21d6',
1462         'nwarr;': '\u2196',
1463         'nwarrow;': '\u2196',
1464         'nwnear;': '\u2927',
1465         'Oacute': '\xd3',
1466         'oacute': '\xf3',
1467         'Oacute;': '\xd3',
1468         'oacute;': '\xf3',
1469         'oast;': '\u229b',
1470         'ocir;': '\u229a',
1471         'Ocirc': '\xd4',
1472         'ocirc': '\xf4',
1473         'Ocirc;': '\xd4',
1474         'ocirc;': '\xf4',
1475         'Ocy;': '\u041e',
1476         'ocy;': '\u043e',
1477         'odash;': '\u229d',
1478         'Odblac;': '\u0150',
1479         'odblac;': '\u0151',
1480         'odiv;': '\u2a38',
1481         'odot;': '\u2299',
1482         'odsold;': '\u29bc',
1483         'OElig;': '\u0152',
1484         'oelig;': '\u0153',
1485         'ofcir;': '\u29bf',
1486         'Ofr;': '\U0001d512',
1487         'ofr;': '\U0001d52c',
1488         'ogon;': '\u02db',
1489         'Ograve': '\xd2',
1490         'ograve': '\xf2',
1491         'Ograve;': '\xd2',
1492         'ograve;': '\xf2',
1493         'ogt;': '\u29c1',
1494         'ohbar;': '\u29b5',
1495         'ohm;': '\u03a9',
1496         'oint;': '\u222e',
1497         'olarr;': '\u21ba',
1498         'olcir;': '\u29be',
1499         'olcross;': '\u29bb',
1500         'oline;': '\u203e',
1501         'olt;': '\u29c0',
1502         'Omacr;': '\u014c',
1503         'omacr;': '\u014d',
1504         'Omega;': '\u03a9',
1505         'omega;': '\u03c9',
1506         'Omicron;': '\u039f',
1507         'omicron;': '\u03bf',
1508         'omid;': '\u29b6',
1509         'ominus;': '\u2296',
1510         'Oopf;': '\U0001d546',
1511         'oopf;': '\U0001d560',
1512         'opar;': '\u29b7',
1513         'OpenCurlyDoubleQuote;': '\u201c',
1514         'OpenCurlyQuote;': '\u2018',
1515         'operp;': '\u29b9',
1516         'oplus;': '\u2295',
1517         'Or;': '\u2a54',
1518         'or;': '\u2228',
1519         'orarr;': '\u21bb',
1520         'ord;': '\u2a5d',
1521         'order;': '\u2134',
1522         'orderof;': '\u2134',
1523         'ordf': '\xaa',
1524         'ordf;': '\xaa',
1525         'ordm': '\xba',
1526         'ordm;': '\xba',
1527         'origof;': '\u22b6',
1528         'oror;': '\u2a56',
1529         'orslope;': '\u2a57',
1530         'orv;': '\u2a5b',
1531         'oS;': '\u24c8',
1532         'Oscr;': '\U0001d4aa',
1533         'oscr;': '\u2134',
1534         'Oslash': '\xd8',
1535         'oslash': '\xf8',
1536         'Oslash;': '\xd8',
1537         'oslash;': '\xf8',
1538         'osol;': '\u2298',
1539         'Otilde': '\xd5',
1540         'otilde': '\xf5',
1541         'Otilde;': '\xd5',
1542         'otilde;': '\xf5',
1543         'Otimes;': '\u2a37',
1544         'otimes;': '\u2297',
1545         'otimesas;': '\u2a36',
1546         'Ouml': '\xd6',
1547         'ouml': '\xf6',
1548         'Ouml;': '\xd6',
1549         'ouml;': '\xf6',
1550         'ovbar;': '\u233d',
1551         'OverBar;': '\u203e',
1552         'OverBrace;': '\u23de',
1553         'OverBracket;': '\u23b4',
1554         'OverParenthesis;': '\u23dc',
1555         'par;': '\u2225',
1556         'para': '\xb6',
1557         'para;': '\xb6',
1558         'parallel;': '\u2225',
1559         'parsim;': '\u2af3',
1560         'parsl;': '\u2afd',
1561         'part;': '\u2202',
1562         'PartialD;': '\u2202',
1563         'Pcy;': '\u041f',
1564         'pcy;': '\u043f',
1565         'percnt;': '%',
1566         'period;': '.',
1567         'permil;': '\u2030',
1568         'perp;': '\u22a5',
1569         'pertenk;': '\u2031',
1570         'Pfr;': '\U0001d513',
1571         'pfr;': '\U0001d52d',
1572         'Phi;': '\u03a6',
1573         'phi;': '\u03c6',
1574         'phiv;': '\u03d5',
1575         'phmmat;': '\u2133',
1576         'phone;': '\u260e',
1577         'Pi;': '\u03a0',
1578         'pi;': '\u03c0',
1579         'pitchfork;': '\u22d4',
1580         'piv;': '\u03d6',
1581         'planck;': '\u210f',
1582         'planckh;': '\u210e',
1583         'plankv;': '\u210f',
1584         'plus;': '+',
1585         'plusacir;': '\u2a23',
1586         'plusb;': '\u229e',
1587         'pluscir;': '\u2a22',
1588         'plusdo;': '\u2214',
1589         'plusdu;': '\u2a25',
1590         'pluse;': '\u2a72',
1591         'PlusMinus;': '\xb1',
1592         'plusmn': '\xb1',
1593         'plusmn;': '\xb1',
1594         'plussim;': '\u2a26',
1595         'plustwo;': '\u2a27',
1596         'pm;': '\xb1',
1597         'Poincareplane;': '\u210c',
1598         'pointint;': '\u2a15',
1599         'Popf;': '\u2119',
1600         'popf;': '\U0001d561',
1601         'pound': '\xa3',
1602         'pound;': '\xa3',
1603         'Pr;': '\u2abb',
1604         'pr;': '\u227a',
1605         'prap;': '\u2ab7',
1606         'prcue;': '\u227c',
1607         'prE;': '\u2ab3',
1608         'pre;': '\u2aaf',
1609         'prec;': '\u227a',
1610         'precapprox;': '\u2ab7',
1611         'preccurlyeq;': '\u227c',
1612         'Precedes;': '\u227a',
1613         'PrecedesEqual;': '\u2aaf',
1614         'PrecedesSlantEqual;': '\u227c',
1615         'PrecedesTilde;': '\u227e',
1616         'preceq;': '\u2aaf',
1617         'precnapprox;': '\u2ab9',
1618         'precneqq;': '\u2ab5',
1619         'precnsim;': '\u22e8',
1620         'precsim;': '\u227e',
1621         'Prime;': '\u2033',
1622         'prime;': '\u2032',
1623         'primes;': '\u2119',
1624         'prnap;': '\u2ab9',
1625         'prnE;': '\u2ab5',
1626         'prnsim;': '\u22e8',
1627         'prod;': '\u220f',
1628         'Product;': '\u220f',
1629         'profalar;': '\u232e',
1630         'profline;': '\u2312',
1631         'profsurf;': '\u2313',
1632         'prop;': '\u221d',
1633         'Proportion;': '\u2237',
1634         'Proportional;': '\u221d',
1635         'propto;': '\u221d',
1636         'prsim;': '\u227e',
1637         'prurel;': '\u22b0',
1638         'Pscr;': '\U0001d4ab',
1639         'pscr;': '\U0001d4c5',
1640         'Psi;': '\u03a8',
1641         'psi;': '\u03c8',
1642         'puncsp;': '\u2008',
1643         'Qfr;': '\U0001d514',
1644         'qfr;': '\U0001d52e',
1645         'qint;': '\u2a0c',
1646         'Qopf;': '\u211a',
1647         'qopf;': '\U0001d562',
1648         'qprime;': '\u2057',
1649         'Qscr;': '\U0001d4ac',
1650         'qscr;': '\U0001d4c6',
1651         'quaternions;': '\u210d',
1652         'quatint;': '\u2a16',
1653         'quest;': '?',
1654         'questeq;': '\u225f',
1655         'QUOT': '"',
1656         'quot': '"',
1657         'QUOT;': '"',
1658         'quot;': '"',
1659         'rAarr;': '\u21db',
1660         'race;': '\u223d\u0331',
1661         'Racute;': '\u0154',
1662         'racute;': '\u0155',
1663         'radic;': '\u221a',
1664         'raemptyv;': '\u29b3',
1665         'Rang;': '\u27eb',
1666         'rang;': '\u27e9',
1667         'rangd;': '\u2992',
1668         'range;': '\u29a5',
1669         'rangle;': '\u27e9',
1670         'raquo': '\xbb',
1671         'raquo;': '\xbb',
1672         'Rarr;': '\u21a0',
1673         'rArr;': '\u21d2',
1674         'rarr;': '\u2192',
1675         'rarrap;': '\u2975',
1676         'rarrb;': '\u21e5',
1677         'rarrbfs;': '\u2920',
1678         'rarrc;': '\u2933',
1679         'rarrfs;': '\u291e',
1680         'rarrhk;': '\u21aa',
1681         'rarrlp;': '\u21ac',
1682         'rarrpl;': '\u2945',
1683         'rarrsim;': '\u2974',
1684         'Rarrtl;': '\u2916',
1685         'rarrtl;': '\u21a3',
1686         'rarrw;': '\u219d',
1687         'rAtail;': '\u291c',
1688         'ratail;': '\u291a',
1689         'ratio;': '\u2236',
1690         'rationals;': '\u211a',
1691         'RBarr;': '\u2910',
1692         'rBarr;': '\u290f',
1693         'rbarr;': '\u290d',
1694         'rbbrk;': '\u2773',
1695         'rbrace;': '}',
1696         'rbrack;': ']',
1697         'rbrke;': '\u298c',
1698         'rbrksld;': '\u298e',
1699         'rbrkslu;': '\u2990',
1700         'Rcaron;': '\u0158',
1701         'rcaron;': '\u0159',
1702         'Rcedil;': '\u0156',
1703         'rcedil;': '\u0157',
1704         'rceil;': '\u2309',
1705         'rcub;': '}',
1706         'Rcy;': '\u0420',
1707         'rcy;': '\u0440',
1708         'rdca;': '\u2937',
1709         'rdldhar;': '\u2969',
1710         'rdquo;': '\u201d',
1711         'rdquor;': '\u201d',
1712         'rdsh;': '\u21b3',
1713         'Re;': '\u211c',
1714         'real;': '\u211c',
1715         'realine;': '\u211b',
1716         'realpart;': '\u211c',
1717         'reals;': '\u211d',
1718         'rect;': '\u25ad',
1719         'REG': '\xae',
1720         'reg': '\xae',
1721         'REG;': '\xae',
1722         'reg;': '\xae',
1723         'ReverseElement;': '\u220b',
1724         'ReverseEquilibrium;': '\u21cb',
1725         'ReverseUpEquilibrium;': '\u296f',
1726         'rfisht;': '\u297d',
1727         'rfloor;': '\u230b',
1728         'Rfr;': '\u211c',
1729         'rfr;': '\U0001d52f',
1730         'rHar;': '\u2964',
1731         'rhard;': '\u21c1',
1732         'rharu;': '\u21c0',
1733         'rharul;': '\u296c',
1734         'Rho;': '\u03a1',
1735         'rho;': '\u03c1',
1736         'rhov;': '\u03f1',
1737         'RightAngleBracket;': '\u27e9',
1738         'RightArrow;': '\u2192',
1739         'Rightarrow;': '\u21d2',
1740         'rightarrow;': '\u2192',
1741         'RightArrowBar;': '\u21e5',
1742         'RightArrowLeftArrow;': '\u21c4',
1743         'rightarrowtail;': '\u21a3',
1744         'RightCeiling;': '\u2309',
1745         'RightDoubleBracket;': '\u27e7',
1746         'RightDownTeeVector;': '\u295d',
1747         'RightDownVector;': '\u21c2',
1748         'RightDownVectorBar;': '\u2955',
1749         'RightFloor;': '\u230b',
1750         'rightharpoondown;': '\u21c1',
1751         'rightharpoonup;': '\u21c0',
1752         'rightleftarrows;': '\u21c4',
1753         'rightleftharpoons;': '\u21cc',
1754         'rightrightarrows;': '\u21c9',
1755         'rightsquigarrow;': '\u219d',
1756         'RightTee;': '\u22a2',
1757         'RightTeeArrow;': '\u21a6',
1758         'RightTeeVector;': '\u295b',
1759         'rightthreetimes;': '\u22cc',
1760         'RightTriangle;': '\u22b3',
1761         'RightTriangleBar;': '\u29d0',
1762         'RightTriangleEqual;': '\u22b5',
1763         'RightUpDownVector;': '\u294f',
1764         'RightUpTeeVector;': '\u295c',
1765         'RightUpVector;': '\u21be',
1766         'RightUpVectorBar;': '\u2954',
1767         'RightVector;': '\u21c0',
1768         'RightVectorBar;': '\u2953',
1769         'ring;': '\u02da',
1770         'risingdotseq;': '\u2253',
1771         'rlarr;': '\u21c4',
1772         'rlhar;': '\u21cc',
1773         'rlm;': '\u200f',
1774         'rmoust;': '\u23b1',
1775         'rmoustache;': '\u23b1',
1776         'rnmid;': '\u2aee',
1777         'roang;': '\u27ed',
1778         'roarr;': '\u21fe',
1779         'robrk;': '\u27e7',
1780         'ropar;': '\u2986',
1781         'Ropf;': '\u211d',
1782         'ropf;': '\U0001d563',
1783         'roplus;': '\u2a2e',
1784         'rotimes;': '\u2a35',
1785         'RoundImplies;': '\u2970',
1786         'rpar;': ')',
1787         'rpargt;': '\u2994',
1788         'rppolint;': '\u2a12',
1789         'rrarr;': '\u21c9',
1790         'Rrightarrow;': '\u21db',
1791         'rsaquo;': '\u203a',
1792         'Rscr;': '\u211b',
1793         'rscr;': '\U0001d4c7',
1794         'Rsh;': '\u21b1',
1795         'rsh;': '\u21b1',
1796         'rsqb;': ']',
1797         'rsquo;': '\u2019',
1798         'rsquor;': '\u2019',
1799         'rthree;': '\u22cc',
1800         'rtimes;': '\u22ca',
1801         'rtri;': '\u25b9',
1802         'rtrie;': '\u22b5',
1803         'rtrif;': '\u25b8',
1804         'rtriltri;': '\u29ce',
1805         'RuleDelayed;': '\u29f4',
1806         'ruluhar;': '\u2968',
1807         'rx;': '\u211e',
1808         'Sacute;': '\u015a',
1809         'sacute;': '\u015b',
1810         'sbquo;': '\u201a',
1811         'Sc;': '\u2abc',
1812         'sc;': '\u227b',
1813         'scap;': '\u2ab8',
1814         'Scaron;': '\u0160',
1815         'scaron;': '\u0161',
1816         'sccue;': '\u227d',
1817         'scE;': '\u2ab4',
1818         'sce;': '\u2ab0',
1819         'Scedil;': '\u015e',
1820         'scedil;': '\u015f',
1821         'Scirc;': '\u015c',
1822         'scirc;': '\u015d',
1823         'scnap;': '\u2aba',
1824         'scnE;': '\u2ab6',
1825         'scnsim;': '\u22e9',
1826         'scpolint;': '\u2a13',
1827         'scsim;': '\u227f',
1828         'Scy;': '\u0421',
1829         'scy;': '\u0441',
1830         'sdot;': '\u22c5',
1831         'sdotb;': '\u22a1',
1832         'sdote;': '\u2a66',
1833         'searhk;': '\u2925',
1834         'seArr;': '\u21d8',
1835         'searr;': '\u2198',
1836         'searrow;': '\u2198',
1837         'sect': '\xa7',
1838         'sect;': '\xa7',
1839         'semi;': ';',
1840         'seswar;': '\u2929',
1841         'setminus;': '\u2216',
1842         'setmn;': '\u2216',
1843         'sext;': '\u2736',
1844         'Sfr;': '\U0001d516',
1845         'sfr;': '\U0001d530',
1846         'sfrown;': '\u2322',
1847         'sharp;': '\u266f',
1848         'SHCHcy;': '\u0429',
1849         'shchcy;': '\u0449',
1850         'SHcy;': '\u0428',
1851         'shcy;': '\u0448',
1852         'ShortDownArrow;': '\u2193',
1853         'ShortLeftArrow;': '\u2190',
1854         'shortmid;': '\u2223',
1855         'shortparallel;': '\u2225',
1856         'ShortRightArrow;': '\u2192',
1857         'ShortUpArrow;': '\u2191',
1858         'shy': '\xad',
1859         'shy;': '\xad',
1860         'Sigma;': '\u03a3',
1861         'sigma;': '\u03c3',
1862         'sigmaf;': '\u03c2',
1863         'sigmav;': '\u03c2',
1864         'sim;': '\u223c',
1865         'simdot;': '\u2a6a',
1866         'sime;': '\u2243',
1867         'simeq;': '\u2243',
1868         'simg;': '\u2a9e',
1869         'simgE;': '\u2aa0',
1870         'siml;': '\u2a9d',
1871         'simlE;': '\u2a9f',
1872         'simne;': '\u2246',
1873         'simplus;': '\u2a24',
1874         'simrarr;': '\u2972',
1875         'slarr;': '\u2190',
1876         'SmallCircle;': '\u2218',
1877         'smallsetminus;': '\u2216',
1878         'smashp;': '\u2a33',
1879         'smeparsl;': '\u29e4',
1880         'smid;': '\u2223',
1881         'smile;': '\u2323',
1882         'smt;': '\u2aaa',
1883         'smte;': '\u2aac',
1884         'smtes;': '\u2aac\ufe00',
1885         'SOFTcy;': '\u042c',
1886         'softcy;': '\u044c',
1887         'sol;': '/',
1888         'solb;': '\u29c4',
1889         'solbar;': '\u233f',
1890         'Sopf;': '\U0001d54a',
1891         'sopf;': '\U0001d564',
1892         'spades;': '\u2660',
1893         'spadesuit;': '\u2660',
1894         'spar;': '\u2225',
1895         'sqcap;': '\u2293',
1896         'sqcaps;': '\u2293\ufe00',
1897         'sqcup;': '\u2294',
1898         'sqcups;': '\u2294\ufe00',
1899         'Sqrt;': '\u221a',
1900         'sqsub;': '\u228f',
1901         'sqsube;': '\u2291',
1902         'sqsubset;': '\u228f',
1903         'sqsubseteq;': '\u2291',
1904         'sqsup;': '\u2290',
1905         'sqsupe;': '\u2292',
1906         'sqsupset;': '\u2290',
1907         'sqsupseteq;': '\u2292',
1908         'squ;': '\u25a1',
1909         'Square;': '\u25a1',
1910         'square;': '\u25a1',
1911         'SquareIntersection;': '\u2293',
1912         'SquareSubset;': '\u228f',
1913         'SquareSubsetEqual;': '\u2291',
1914         'SquareSuperset;': '\u2290',
1915         'SquareSupersetEqual;': '\u2292',
1916         'SquareUnion;': '\u2294',
1917         'squarf;': '\u25aa',
1918         'squf;': '\u25aa',
1919         'srarr;': '\u2192',
1920         'Sscr;': '\U0001d4ae',
1921         'sscr;': '\U0001d4c8',
1922         'ssetmn;': '\u2216',
1923         'ssmile;': '\u2323',
1924         'sstarf;': '\u22c6',
1925         'Star;': '\u22c6',
1926         'star;': '\u2606',
1927         'starf;': '\u2605',
1928         'straightepsilon;': '\u03f5',
1929         'straightphi;': '\u03d5',
1930         'strns;': '\xaf',
1931         'Sub;': '\u22d0',
1932         'sub;': '\u2282',
1933         'subdot;': '\u2abd',
1934         'subE;': '\u2ac5',
1935         'sube;': '\u2286',
1936         'subedot;': '\u2ac3',
1937         'submult;': '\u2ac1',
1938         'subnE;': '\u2acb',
1939         'subne;': '\u228a',
1940         'subplus;': '\u2abf',
1941         'subrarr;': '\u2979',
1942         'Subset;': '\u22d0',
1943         'subset;': '\u2282',
1944         'subseteq;': '\u2286',
1945         'subseteqq;': '\u2ac5',
1946         'SubsetEqual;': '\u2286',
1947         'subsetneq;': '\u228a',
1948         'subsetneqq;': '\u2acb',
1949         'subsim;': '\u2ac7',
1950         'subsub;': '\u2ad5',
1951         'subsup;': '\u2ad3',
1952         'succ;': '\u227b',
1953         'succapprox;': '\u2ab8',
1954         'succcurlyeq;': '\u227d',
1955         'Succeeds;': '\u227b',
1956         'SucceedsEqual;': '\u2ab0',
1957         'SucceedsSlantEqual;': '\u227d',
1958         'SucceedsTilde;': '\u227f',
1959         'succeq;': '\u2ab0',
1960         'succnapprox;': '\u2aba',
1961         'succneqq;': '\u2ab6',
1962         'succnsim;': '\u22e9',
1963         'succsim;': '\u227f',
1964         'SuchThat;': '\u220b',
1965         'Sum;': '\u2211',
1966         'sum;': '\u2211',
1967         'sung;': '\u266a',
1968         'sup1': '\xb9',
1969         'sup1;': '\xb9',
1970         'sup2': '\xb2',
1971         'sup2;': '\xb2',
1972         'sup3': '\xb3',
1973         'sup3;': '\xb3',
1974         'Sup;': '\u22d1',
1975         'sup;': '\u2283',
1976         'supdot;': '\u2abe',
1977         'supdsub;': '\u2ad8',
1978         'supE;': '\u2ac6',
1979         'supe;': '\u2287',
1980         'supedot;': '\u2ac4',
1981         'Superset;': '\u2283',
1982         'SupersetEqual;': '\u2287',
1983         'suphsol;': '\u27c9',
1984         'suphsub;': '\u2ad7',
1985         'suplarr;': '\u297b',
1986         'supmult;': '\u2ac2',
1987         'supnE;': '\u2acc',
1988         'supne;': '\u228b',
1989         'supplus;': '\u2ac0',
1990         'Supset;': '\u22d1',
1991         'supset;': '\u2283',
1992         'supseteq;': '\u2287',
1993         'supseteqq;': '\u2ac6',
1994         'supsetneq;': '\u228b',
1995         'supsetneqq;': '\u2acc',
1996         'supsim;': '\u2ac8',
1997         'supsub;': '\u2ad4',
1998         'supsup;': '\u2ad6',
1999         'swarhk;': '\u2926',
2000         'swArr;': '\u21d9',
2001         'swarr;': '\u2199',
2002         'swarrow;': '\u2199',
2003         'swnwar;': '\u292a',
2004         'szlig': '\xdf',
2005         'szlig;': '\xdf',
2006         'Tab;': '\t',
2007         'target;': '\u2316',
2008         'Tau;': '\u03a4',
2009         'tau;': '\u03c4',
2010         'tbrk;': '\u23b4',
2011         'Tcaron;': '\u0164',
2012         'tcaron;': '\u0165',
2013         'Tcedil;': '\u0162',
2014         'tcedil;': '\u0163',
2015         'Tcy;': '\u0422',
2016         'tcy;': '\u0442',
2017         'tdot;': '\u20db',
2018         'telrec;': '\u2315',
2019         'Tfr;': '\U0001d517',
2020         'tfr;': '\U0001d531',
2021         'there4;': '\u2234',
2022         'Therefore;': '\u2234',
2023         'therefore;': '\u2234',
2024         'Theta;': '\u0398',
2025         'theta;': '\u03b8',
2026         'thetasym;': '\u03d1',
2027         'thetav;': '\u03d1',
2028         'thickapprox;': '\u2248',
2029         'thicksim;': '\u223c',
2030         'ThickSpace;': '\u205f\u200a',
2031         'thinsp;': '\u2009',
2032         'ThinSpace;': '\u2009',
2033         'thkap;': '\u2248',
2034         'thksim;': '\u223c',
2035         'THORN': '\xde',
2036         'thorn': '\xfe',
2037         'THORN;': '\xde',
2038         'thorn;': '\xfe',
2039         'Tilde;': '\u223c',
2040         'tilde;': '\u02dc',
2041         'TildeEqual;': '\u2243',
2042         'TildeFullEqual;': '\u2245',
2043         'TildeTilde;': '\u2248',
2044         'times': '\xd7',
2045         'times;': '\xd7',
2046         'timesb;': '\u22a0',
2047         'timesbar;': '\u2a31',
2048         'timesd;': '\u2a30',
2049         'tint;': '\u222d',
2050         'toea;': '\u2928',
2051         'top;': '\u22a4',
2052         'topbot;': '\u2336',
2053         'topcir;': '\u2af1',
2054         'Topf;': '\U0001d54b',
2055         'topf;': '\U0001d565',
2056         'topfork;': '\u2ada',
2057         'tosa;': '\u2929',
2058         'tprime;': '\u2034',
2059         'TRADE;': '\u2122',
2060         'trade;': '\u2122',
2061         'triangle;': '\u25b5',
2062         'triangledown;': '\u25bf',
2063         'triangleleft;': '\u25c3',
2064         'trianglelefteq;': '\u22b4',
2065         'triangleq;': '\u225c',
2066         'triangleright;': '\u25b9',
2067         'trianglerighteq;': '\u22b5',
2068         'tridot;': '\u25ec',
2069         'trie;': '\u225c',
2070         'triminus;': '\u2a3a',
2071         'TripleDot;': '\u20db',
2072         'triplus;': '\u2a39',
2073         'trisb;': '\u29cd',
2074         'tritime;': '\u2a3b',
2075         'trpezium;': '\u23e2',
2076         'Tscr;': '\U0001d4af',
2077         'tscr;': '\U0001d4c9',
2078         'TScy;': '\u0426',
2079         'tscy;': '\u0446',
2080         'TSHcy;': '\u040b',
2081         'tshcy;': '\u045b',
2082         'Tstrok;': '\u0166',
2083         'tstrok;': '\u0167',
2084         'twixt;': '\u226c',
2085         'twoheadleftarrow;': '\u219e',
2086         'twoheadrightarrow;': '\u21a0',
2087         'Uacute': '\xda',
2088         'uacute': '\xfa',
2089         'Uacute;': '\xda',
2090         'uacute;': '\xfa',
2091         'Uarr;': '\u219f',
2092         'uArr;': '\u21d1',
2093         'uarr;': '\u2191',
2094         'Uarrocir;': '\u2949',
2095         'Ubrcy;': '\u040e',
2096         'ubrcy;': '\u045e',
2097         'Ubreve;': '\u016c',
2098         'ubreve;': '\u016d',
2099         'Ucirc': '\xdb',
2100         'ucirc': '\xfb',
2101         'Ucirc;': '\xdb',
2102         'ucirc;': '\xfb',
2103         'Ucy;': '\u0423',
2104         'ucy;': '\u0443',
2105         'udarr;': '\u21c5',
2106         'Udblac;': '\u0170',
2107         'udblac;': '\u0171',
2108         'udhar;': '\u296e',
2109         'ufisht;': '\u297e',
2110         'Ufr;': '\U0001d518',
2111         'ufr;': '\U0001d532',
2112         'Ugrave': '\xd9',
2113         'ugrave': '\xf9',
2114         'Ugrave;': '\xd9',
2115         'ugrave;': '\xf9',
2116         'uHar;': '\u2963',
2117         'uharl;': '\u21bf',
2118         'uharr;': '\u21be',
2119         'uhblk;': '\u2580',
2120         'ulcorn;': '\u231c',
2121         'ulcorner;': '\u231c',
2122         'ulcrop;': '\u230f',
2123         'ultri;': '\u25f8',
2124         'Umacr;': '\u016a',
2125         'umacr;': '\u016b',
2126         'uml': '\xa8',
2127         'uml;': '\xa8',
2128         'UnderBar;': '_',
2129         'UnderBrace;': '\u23df',
2130         'UnderBracket;': '\u23b5',
2131         'UnderParenthesis;': '\u23dd',
2132         'Union;': '\u22c3',
2133         'UnionPlus;': '\u228e',
2134         'Uogon;': '\u0172',
2135         'uogon;': '\u0173',
2136         'Uopf;': '\U0001d54c',
2137         'uopf;': '\U0001d566',
2138         'UpArrow;': '\u2191',
2139         'Uparrow;': '\u21d1',
2140         'uparrow;': '\u2191',
2141         'UpArrowBar;': '\u2912',
2142         'UpArrowDownArrow;': '\u21c5',
2143         'UpDownArrow;': '\u2195',
2144         'Updownarrow;': '\u21d5',
2145         'updownarrow;': '\u2195',
2146         'UpEquilibrium;': '\u296e',
2147         'upharpoonleft;': '\u21bf',
2148         'upharpoonright;': '\u21be',
2149         'uplus;': '\u228e',
2150         'UpperLeftArrow;': '\u2196',
2151         'UpperRightArrow;': '\u2197',
2152         'Upsi;': '\u03d2',
2153         'upsi;': '\u03c5',
2154         'upsih;': '\u03d2',
2155         'Upsilon;': '\u03a5',
2156         'upsilon;': '\u03c5',
2157         'UpTee;': '\u22a5',
2158         'UpTeeArrow;': '\u21a5',
2159         'upuparrows;': '\u21c8',
2160         'urcorn;': '\u231d',
2161         'urcorner;': '\u231d',
2162         'urcrop;': '\u230e',
2163         'Uring;': '\u016e',
2164         'uring;': '\u016f',
2165         'urtri;': '\u25f9',
2166         'Uscr;': '\U0001d4b0',
2167         'uscr;': '\U0001d4ca',
2168         'utdot;': '\u22f0',
2169         'Utilde;': '\u0168',
2170         'utilde;': '\u0169',
2171         'utri;': '\u25b5',
2172         'utrif;': '\u25b4',
2173         'uuarr;': '\u21c8',
2174         'Uuml': '\xdc',
2175         'uuml': '\xfc',
2176         'Uuml;': '\xdc',
2177         'uuml;': '\xfc',
2178         'uwangle;': '\u29a7',
2179         'vangrt;': '\u299c',
2180         'varepsilon;': '\u03f5',
2181         'varkappa;': '\u03f0',
2182         'varnothing;': '\u2205',
2183         'varphi;': '\u03d5',
2184         'varpi;': '\u03d6',
2185         'varpropto;': '\u221d',
2186         'vArr;': '\u21d5',
2187         'varr;': '\u2195',
2188         'varrho;': '\u03f1',
2189         'varsigma;': '\u03c2',
2190         'varsubsetneq;': '\u228a\ufe00',
2191         'varsubsetneqq;': '\u2acb\ufe00',
2192         'varsupsetneq;': '\u228b\ufe00',
2193         'varsupsetneqq;': '\u2acc\ufe00',
2194         'vartheta;': '\u03d1',
2195         'vartriangleleft;': '\u22b2',
2196         'vartriangleright;': '\u22b3',
2197         'Vbar;': '\u2aeb',
2198         'vBar;': '\u2ae8',
2199         'vBarv;': '\u2ae9',
2200         'Vcy;': '\u0412',
2201         'vcy;': '\u0432',
2202         'VDash;': '\u22ab',
2203         'Vdash;': '\u22a9',
2204         'vDash;': '\u22a8',
2205         'vdash;': '\u22a2',
2206         'Vdashl;': '\u2ae6',
2207         'Vee;': '\u22c1',
2208         'vee;': '\u2228',
2209         'veebar;': '\u22bb',
2210         'veeeq;': '\u225a',
2211         'vellip;': '\u22ee',
2212         'Verbar;': '\u2016',
2213         'verbar;': '|',
2214         'Vert;': '\u2016',
2215         'vert;': '|',
2216         'VerticalBar;': '\u2223',
2217         'VerticalLine;': '|',
2218         'VerticalSeparator;': '\u2758',
2219         'VerticalTilde;': '\u2240',
2220         'VeryThinSpace;': '\u200a',
2221         'Vfr;': '\U0001d519',
2222         'vfr;': '\U0001d533',
2223         'vltri;': '\u22b2',
2224         'vnsub;': '\u2282\u20d2',
2225         'vnsup;': '\u2283\u20d2',
2226         'Vopf;': '\U0001d54d',
2227         'vopf;': '\U0001d567',
2228         'vprop;': '\u221d',
2229         'vrtri;': '\u22b3',
2230         'Vscr;': '\U0001d4b1',
2231         'vscr;': '\U0001d4cb',
2232         'vsubnE;': '\u2acb\ufe00',
2233         'vsubne;': '\u228a\ufe00',
2234         'vsupnE;': '\u2acc\ufe00',
2235         'vsupne;': '\u228b\ufe00',
2236         'Vvdash;': '\u22aa',
2237         'vzigzag;': '\u299a',
2238         'Wcirc;': '\u0174',
2239         'wcirc;': '\u0175',
2240         'wedbar;': '\u2a5f',
2241         'Wedge;': '\u22c0',
2242         'wedge;': '\u2227',
2243         'wedgeq;': '\u2259',
2244         'weierp;': '\u2118',
2245         'Wfr;': '\U0001d51a',
2246         'wfr;': '\U0001d534',
2247         'Wopf;': '\U0001d54e',
2248         'wopf;': '\U0001d568',
2249         'wp;': '\u2118',
2250         'wr;': '\u2240',
2251         'wreath;': '\u2240',
2252         'Wscr;': '\U0001d4b2',
2253         'wscr;': '\U0001d4cc',
2254         'xcap;': '\u22c2',
2255         'xcirc;': '\u25ef',
2256         'xcup;': '\u22c3',
2257         'xdtri;': '\u25bd',
2258         'Xfr;': '\U0001d51b',
2259         'xfr;': '\U0001d535',
2260         'xhArr;': '\u27fa',
2261         'xharr;': '\u27f7',
2262         'Xi;': '\u039e',
2263         'xi;': '\u03be',
2264         'xlArr;': '\u27f8',
2265         'xlarr;': '\u27f5',
2266         'xmap;': '\u27fc',
2267         'xnis;': '\u22fb',
2268         'xodot;': '\u2a00',
2269         'Xopf;': '\U0001d54f',
2270         'xopf;': '\U0001d569',
2271         'xoplus;': '\u2a01',
2272         'xotime;': '\u2a02',
2273         'xrArr;': '\u27f9',
2274         'xrarr;': '\u27f6',
2275         'Xscr;': '\U0001d4b3',
2276         'xscr;': '\U0001d4cd',
2277         'xsqcup;': '\u2a06',
2278         'xuplus;': '\u2a04',
2279         'xutri;': '\u25b3',
2280         'xvee;': '\u22c1',
2281         'xwedge;': '\u22c0',
2282         'Yacute': '\xdd',
2283         'yacute': '\xfd',
2284         'Yacute;': '\xdd',
2285         'yacute;': '\xfd',
2286         'YAcy;': '\u042f',
2287         'yacy;': '\u044f',
2288         'Ycirc;': '\u0176',
2289         'ycirc;': '\u0177',
2290         'Ycy;': '\u042b',
2291         'ycy;': '\u044b',
2292         'yen': '\xa5',
2293         'yen;': '\xa5',
2294         'Yfr;': '\U0001d51c',
2295         'yfr;': '\U0001d536',
2296         'YIcy;': '\u0407',
2297         'yicy;': '\u0457',
2298         'Yopf;': '\U0001d550',
2299         'yopf;': '\U0001d56a',
2300         'Yscr;': '\U0001d4b4',
2301         'yscr;': '\U0001d4ce',
2302         'YUcy;': '\u042e',
2303         'yucy;': '\u044e',
2304         'yuml': '\xff',
2305         'Yuml;': '\u0178',
2306         'yuml;': '\xff',
2307         'Zacute;': '\u0179',
2308         'zacute;': '\u017a',
2309         'Zcaron;': '\u017d',
2310         'zcaron;': '\u017e',
2311         'Zcy;': '\u0417',
2312         'zcy;': '\u0437',
2313         'Zdot;': '\u017b',
2314         'zdot;': '\u017c',
2315         'zeetrf;': '\u2128',
2316         'ZeroWidthSpace;': '\u200b',
2317         'Zeta;': '\u0396',
2318         'zeta;': '\u03b6',
2319         'Zfr;': '\u2128',
2320         'zfr;': '\U0001d537',
2321         'ZHcy;': '\u0416',
2322         'zhcy;': '\u0436',
2323         'zigrarr;': '\u21dd',
2324         'Zopf;': '\u2124',
2325         'zopf;': '\U0001d56b',
2326         'Zscr;': '\U0001d4b5',
2327         'zscr;': '\U0001d4cf',
2328         'zwj;': '\u200d',
2329         'zwnj;': '\u200c',
2330     }
2331
2332 try:
2333     import http.client as compat_http_client
2334 except ImportError:  # Python 2
2335     import httplib as compat_http_client
2336
2337 try:
2338     from urllib.error import HTTPError as compat_HTTPError
2339 except ImportError:  # Python 2
2340     from urllib2 import HTTPError as compat_HTTPError
2341
2342 try:
2343     from urllib.request import urlretrieve as compat_urlretrieve
2344 except ImportError:  # Python 2
2345     from urllib import urlretrieve as compat_urlretrieve
2346
2347 try:
2348     from html.parser import HTMLParser as compat_HTMLParser
2349 except ImportError:  # Python 2
2350     from HTMLParser import HTMLParser as compat_HTMLParser
2351
2352 try:  # Python 2
2353     from HTMLParser import HTMLParseError as compat_HTMLParseError
2354 except ImportError:  # Python <3.4
2355     try:
2356         from html.parser import HTMLParseError as compat_HTMLParseError
2357     except ImportError:  # Python >3.4
2358
2359         # HTMLParseError has been deprecated in Python 3.3 and removed in
2360         # Python 3.5. Introducing dummy exception for Python >3.5 for compatible
2361         # and uniform cross-version exception handling
2362         class compat_HTMLParseError(Exception):
2363             pass
2364
2365 try:
2366     from subprocess import DEVNULL
2367     compat_subprocess_get_DEVNULL = lambda: DEVNULL
2368 except ImportError:
2369     compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w')
2370
2371 try:
2372     import http.server as compat_http_server
2373 except ImportError:
2374     import BaseHTTPServer as compat_http_server
2375
2376 try:
2377     compat_str = unicode  # Python 2
2378 except NameError:
2379     compat_str = str
2380
2381 try:
2382     from urllib.parse import unquote_to_bytes as compat_urllib_parse_unquote_to_bytes
2383     from urllib.parse import unquote as compat_urllib_parse_unquote
2384     from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus
2385 except ImportError:  # Python 2
2386     _asciire = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire')
2387                 else re.compile(r'([\x00-\x7f]+)'))
2388
2389     # HACK: The following are the correct unquote_to_bytes, unquote and unquote_plus
2390     # implementations from cpython 3.4.3's stdlib. Python 2's version
2391     # is apparently broken (see https://github.com/ytdl-org/youtube-dl/pull/6244)
2392
2393     def compat_urllib_parse_unquote_to_bytes(string):
2394         """unquote_to_bytes('abc%20def') -> b'abc def'."""
2395         # Note: strings are encoded as UTF-8. This is only an issue if it contains
2396         # unescaped non-ASCII characters, which URIs should not.
2397         if not string:
2398             # Is it a string-like object?
2399             string.split
2400             return b''
2401         if isinstance(string, compat_str):
2402             string = string.encode('utf-8')
2403         bits = string.split(b'%')
2404         if len(bits) == 1:
2405             return string
2406         res = [bits[0]]
2407         append = res.append
2408         for item in bits[1:]:
2409             try:
2410                 append(compat_urllib_parse._hextochr[item[:2]])
2411                 append(item[2:])
2412             except KeyError:
2413                 append(b'%')
2414                 append(item)
2415         return b''.join(res)
2416
2417     def compat_urllib_parse_unquote(string, encoding='utf-8', errors='replace'):
2418         """Replace %xx escapes by their single-character equivalent. The optional
2419         encoding and errors parameters specify how to decode percent-encoded
2420         sequences into Unicode characters, as accepted by the bytes.decode()
2421         method.
2422         By default, percent-encoded sequences are decoded with UTF-8, and invalid
2423         sequences are replaced by a placeholder character.
2424
2425         unquote('abc%20def') -> 'abc def'.
2426         """
2427         if '%' not in string:
2428             string.split
2429             return string
2430         if encoding is None:
2431             encoding = 'utf-8'
2432         if errors is None:
2433             errors = 'replace'
2434         bits = _asciire.split(string)
2435         res = [bits[0]]
2436         append = res.append
2437         for i in range(1, len(bits), 2):
2438             append(compat_urllib_parse_unquote_to_bytes(bits[i]).decode(encoding, errors))
2439             append(bits[i + 1])
2440         return ''.join(res)
2441
2442     def compat_urllib_parse_unquote_plus(string, encoding='utf-8', errors='replace'):
2443         """Like unquote(), but also replace plus signs by spaces, as required for
2444         unquoting HTML form values.
2445
2446         unquote_plus('%7e/abc+def') -> '~/abc def'
2447         """
2448         string = string.replace('+', ' ')
2449         return compat_urllib_parse_unquote(string, encoding, errors)
2450
2451 try:
2452     from urllib.parse import urlencode as compat_urllib_parse_urlencode
2453 except ImportError:  # Python 2
2454     # Python 2 will choke in urlencode on mixture of byte and unicode strings.
2455     # Possible solutions are to either port it from python 3 with all
2456     # the friends or manually ensure input query contains only byte strings.
2457     # We will stick with latter thus recursively encoding the whole query.
2458     def compat_urllib_parse_urlencode(query, doseq=0, encoding='utf-8'):
2459         def encode_elem(e):
2460             if isinstance(e, dict):
2461                 e = encode_dict(e)
2462             elif isinstance(e, (list, tuple,)):
2463                 list_e = encode_list(e)
2464                 e = tuple(list_e) if isinstance(e, tuple) else list_e
2465             elif isinstance(e, compat_str):
2466                 e = e.encode(encoding)
2467             return e
2468
2469         def encode_dict(d):
2470             return dict((encode_elem(k), encode_elem(v)) for k, v in d.items())
2471
2472         def encode_list(l):
2473             return [encode_elem(e) for e in l]
2474
2475         return compat_urllib_parse.urlencode(encode_elem(query), doseq=doseq)
2476
2477 try:
2478     from urllib.request import DataHandler as compat_urllib_request_DataHandler
2479 except ImportError:  # Python < 3.4
2480     # Ported from CPython 98774:1733b3bd46db, Lib/urllib/request.py
2481     class compat_urllib_request_DataHandler(compat_urllib_request.BaseHandler):
2482         def data_open(self, req):
2483             # data URLs as specified in RFC 2397.
2484             #
2485             # ignores POSTed data
2486             #
2487             # syntax:
2488             # dataurl   := "data:" [ mediatype ] [ ";base64" ] "," data
2489             # mediatype := [ type "/" subtype ] *( ";" parameter )
2490             # data      := *urlchar
2491             # parameter := attribute "=" value
2492             url = req.get_full_url()
2493
2494             scheme, data = url.split(':', 1)
2495             mediatype, data = data.split(',', 1)
2496
2497             # even base64 encoded data URLs might be quoted so unquote in any case:
2498             data = compat_urllib_parse_unquote_to_bytes(data)
2499             if mediatype.endswith(';base64'):
2500                 data = binascii.a2b_base64(data)
2501                 mediatype = mediatype[:-7]
2502
2503             if not mediatype:
2504                 mediatype = 'text/plain;charset=US-ASCII'
2505
2506             headers = email.message_from_string(
2507                 'Content-type: %s\nContent-length: %d\n' % (mediatype, len(data)))
2508
2509             return compat_urllib_response.addinfourl(io.BytesIO(data), headers, url)
2510
2511 try:
2512     compat_basestring = basestring  # Python 2
2513 except NameError:
2514     compat_basestring = str
2515
2516 try:
2517     compat_chr = unichr  # Python 2
2518 except NameError:
2519     compat_chr = chr
2520
2521 try:
2522     from xml.etree.ElementTree import ParseError as compat_xml_parse_error
2523 except ImportError:  # Python 2.6
2524     from xml.parsers.expat import ExpatError as compat_xml_parse_error
2525
2526
2527 etree = xml.etree.ElementTree
2528
2529
2530 class _TreeBuilder(etree.TreeBuilder):
2531     def doctype(self, name, pubid, system):
2532         pass
2533
2534
2535 try:
2536     # xml.etree.ElementTree.Element is a method in Python <=2.6 and
2537     # the following will crash with:
2538     #  TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
2539     isinstance(None, xml.etree.ElementTree.Element)
2540     from xml.etree.ElementTree import Element as compat_etree_Element
2541 except TypeError:  # Python <=2.6
2542     from xml.etree.ElementTree import _ElementInterface as compat_etree_Element
2543
2544 if sys.version_info[0] >= 3:
2545     def compat_etree_fromstring(text):
2546         return etree.XML(text, parser=etree.XMLParser(target=_TreeBuilder()))
2547 else:
2548     # python 2.x tries to encode unicode strings with ascii (see the
2549     # XMLParser._fixtext method)
2550     try:
2551         _etree_iter = etree.Element.iter
2552     except AttributeError:  # Python <=2.6
2553         def _etree_iter(root):
2554             for el in root.findall('*'):
2555                 yield el
2556                 for sub in _etree_iter(el):
2557                     yield sub
2558
2559     # on 2.6 XML doesn't have a parser argument, function copied from CPython
2560     # 2.7 source
2561     def _XML(text, parser=None):
2562         if not parser:
2563             parser = etree.XMLParser(target=_TreeBuilder())
2564         parser.feed(text)
2565         return parser.close()
2566
2567     def _element_factory(*args, **kwargs):
2568         el = etree.Element(*args, **kwargs)
2569         for k, v in el.items():
2570             if isinstance(v, bytes):
2571                 el.set(k, v.decode('utf-8'))
2572         return el
2573
2574     def compat_etree_fromstring(text):
2575         doc = _XML(text, parser=etree.XMLParser(target=_TreeBuilder(element_factory=_element_factory)))
2576         for el in _etree_iter(doc):
2577             if el.text is not None and isinstance(el.text, bytes):
2578                 el.text = el.text.decode('utf-8')
2579         return doc
2580
2581 if hasattr(etree, 'register_namespace'):
2582     compat_etree_register_namespace = etree.register_namespace
2583 else:
2584     def compat_etree_register_namespace(prefix, uri):
2585         """Register a namespace prefix.
2586         The registry is global, and any existing mapping for either the
2587         given prefix or the namespace URI will be removed.
2588         *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
2589         attributes in this namespace will be serialized with prefix if possible.
2590         ValueError is raised if prefix is reserved or is invalid.
2591         """
2592         if re.match(r"ns\d+$", prefix):
2593             raise ValueError("Prefix format reserved for internal use")
2594         for k, v in list(etree._namespace_map.items()):
2595             if k == uri or v == prefix:
2596                 del etree._namespace_map[k]
2597         etree._namespace_map[uri] = prefix
2598
2599 if sys.version_info < (2, 7):
2600     # Here comes the crazy part: In 2.6, if the xpath is a unicode,
2601     # .//node does not match if a node is a direct child of . !
2602     def compat_xpath(xpath):
2603         if isinstance(xpath, compat_str):
2604             xpath = xpath.encode('ascii')
2605         return xpath
2606 else:
2607     compat_xpath = lambda xpath: xpath
2608
2609 try:
2610     from urllib.parse import parse_qs as compat_parse_qs
2611 except ImportError:  # Python 2
2612     # HACK: The following is the correct parse_qs implementation from cpython 3's stdlib.
2613     # Python 2's version is apparently totally broken
2614
2615     def _parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
2616                    encoding='utf-8', errors='replace'):
2617         qs, _coerce_result = qs, compat_str
2618         pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
2619         r = []
2620         for name_value in pairs:
2621             if not name_value and not strict_parsing:
2622                 continue
2623             nv = name_value.split('=', 1)
2624             if len(nv) != 2:
2625                 if strict_parsing:
2626                     raise ValueError('bad query field: %r' % (name_value,))
2627                 # Handle case of a control-name with no equal sign
2628                 if keep_blank_values:
2629                     nv.append('')
2630                 else:
2631                     continue
2632             if len(nv[1]) or keep_blank_values:
2633                 name = nv[0].replace('+', ' ')
2634                 name = compat_urllib_parse_unquote(
2635                     name, encoding=encoding, errors=errors)
2636                 name = _coerce_result(name)
2637                 value = nv[1].replace('+', ' ')
2638                 value = compat_urllib_parse_unquote(
2639                     value, encoding=encoding, errors=errors)
2640                 value = _coerce_result(value)
2641                 r.append((name, value))
2642         return r
2643
2644     def compat_parse_qs(qs, keep_blank_values=False, strict_parsing=False,
2645                         encoding='utf-8', errors='replace'):
2646         parsed_result = {}
2647         pairs = _parse_qsl(qs, keep_blank_values, strict_parsing,
2648                            encoding=encoding, errors=errors)
2649         for name, value in pairs:
2650             if name in parsed_result:
2651                 parsed_result[name].append(value)
2652             else:
2653                 parsed_result[name] = [value]
2654         return parsed_result
2655
2656
2657 compat_os_name = os._name if os.name == 'java' else os.name
2658
2659
2660 if compat_os_name == 'nt':
2661     def compat_shlex_quote(s):
2662         return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
2663 else:
2664     try:
2665         from shlex import quote as compat_shlex_quote
2666     except ImportError:  # Python < 3.3
2667         def compat_shlex_quote(s):
2668             if re.match(r'^[-_\w./]+$', s):
2669                 return s
2670             else:
2671                 return "'" + s.replace("'", "'\"'\"'") + "'"
2672
2673
2674 try:
2675     args = shlex.split('中文')
2676     assert (isinstance(args, list)
2677             and isinstance(args[0], compat_str)
2678             and args[0] == '中文')
2679     compat_shlex_split = shlex.split
2680 except (AssertionError, UnicodeEncodeError):
2681     # Working around shlex issue with unicode strings on some python 2
2682     # versions (see http://bugs.python.org/issue1548891)
2683     def compat_shlex_split(s, comments=False, posix=True):
2684         if isinstance(s, compat_str):
2685             s = s.encode('utf-8')
2686         return list(map(lambda s: s.decode('utf-8'), shlex.split(s, comments, posix)))
2687
2688
2689 def compat_ord(c):
2690     if type(c) is int:
2691         return c
2692     else:
2693         return ord(c)
2694
2695
2696 if sys.version_info >= (3, 0):
2697     compat_getenv = os.getenv
2698     compat_expanduser = os.path.expanduser
2699
2700     def compat_setenv(key, value, env=os.environ):
2701         env[key] = value
2702 else:
2703     # Environment variables should be decoded with filesystem encoding.
2704     # Otherwise it will fail if any non-ASCII characters present (see #3854 #3217 #2918)
2705
2706     def compat_getenv(key, default=None):
2707         from .utils import get_filesystem_encoding
2708         env = os.getenv(key, default)
2709         if env:
2710             env = env.decode(get_filesystem_encoding())
2711         return env
2712
2713     def compat_setenv(key, value, env=os.environ):
2714         def encode(v):
2715             from .utils import get_filesystem_encoding
2716             return v.encode(get_filesystem_encoding()) if isinstance(v, compat_str) else v
2717         env[encode(key)] = encode(value)
2718
2719     # HACK: The default implementations of os.path.expanduser from cpython do not decode
2720     # environment variables with filesystem encoding. We will work around this by
2721     # providing adjusted implementations.
2722     # The following are os.path.expanduser implementations from cpython 2.7.8 stdlib
2723     # for different platforms with correct environment variables decoding.
2724
2725     if compat_os_name == 'posix':
2726         def compat_expanduser(path):
2727             """Expand ~ and ~user constructions.  If user or $HOME is unknown,
2728             do nothing."""
2729             if not path.startswith('~'):
2730                 return path
2731             i = path.find('/', 1)
2732             if i < 0:
2733                 i = len(path)
2734             if i == 1:
2735                 if 'HOME' not in os.environ:
2736                     import pwd
2737                     userhome = pwd.getpwuid(os.getuid()).pw_dir
2738                 else:
2739                     userhome = compat_getenv('HOME')
2740             else:
2741                 import pwd
2742                 try:
2743                     pwent = pwd.getpwnam(path[1:i])
2744                 except KeyError:
2745                     return path
2746                 userhome = pwent.pw_dir
2747             userhome = userhome.rstrip('/')
2748             return (userhome + path[i:]) or '/'
2749     elif compat_os_name in ('nt', 'ce'):
2750         def compat_expanduser(path):
2751             """Expand ~ and ~user constructs.
2752
2753             If user or $HOME is unknown, do nothing."""
2754             if path[:1] != '~':
2755                 return path
2756             i, n = 1, len(path)
2757             while i < n and path[i] not in '/\\':
2758                 i = i + 1
2759
2760             if 'HOME' in os.environ:
2761                 userhome = compat_getenv('HOME')
2762             elif 'USERPROFILE' in os.environ:
2763                 userhome = compat_getenv('USERPROFILE')
2764             elif 'HOMEPATH' not in os.environ:
2765                 return path
2766             else:
2767                 try:
2768                     drive = compat_getenv('HOMEDRIVE')
2769                 except KeyError:
2770                     drive = ''
2771                 userhome = os.path.join(drive, compat_getenv('HOMEPATH'))
2772
2773             if i != 1:  # ~user
2774                 userhome = os.path.join(os.path.dirname(userhome), path[1:i])
2775
2776             return userhome + path[i:]
2777     else:
2778         compat_expanduser = os.path.expanduser
2779
2780
2781 if compat_os_name == 'nt' and sys.version_info < (3, 8):
2782     # os.path.realpath on Windows does not follow symbolic links
2783     # prior to Python 3.8 (see https://bugs.python.org/issue9949)
2784     def compat_realpath(path):
2785         while os.path.islink(path):
2786             path = os.path.abspath(os.readlink(path))
2787         return path
2788 else:
2789     compat_realpath = os.path.realpath
2790
2791
2792 if sys.version_info < (3, 0):
2793     def compat_print(s):
2794         from .utils import preferredencoding
2795         print(s.encode(preferredencoding(), 'xmlcharrefreplace'))
2796 else:
2797     def compat_print(s):
2798         assert isinstance(s, compat_str)
2799         print(s)
2800
2801
2802 if sys.version_info < (3, 0) and sys.platform == 'win32':
2803     def compat_getpass(prompt, *args, **kwargs):
2804         if isinstance(prompt, compat_str):
2805             from .utils import preferredencoding
2806             prompt = prompt.encode(preferredencoding())
2807         return getpass.getpass(prompt, *args, **kwargs)
2808 else:
2809     compat_getpass = getpass.getpass
2810
2811 try:
2812     compat_input = raw_input
2813 except NameError:  # Python 3
2814     compat_input = input
2815
2816 # Python < 2.6.5 require kwargs to be bytes
2817 try:
2818     def _testfunc(x):
2819         pass
2820     _testfunc(**{'x': 0})
2821 except TypeError:
2822     def compat_kwargs(kwargs):
2823         return dict((bytes(k), v) for k, v in kwargs.items())
2824 else:
2825     compat_kwargs = lambda kwargs: kwargs
2826
2827
2828 try:
2829     compat_numeric_types = (int, float, long, complex)
2830 except NameError:  # Python 3
2831     compat_numeric_types = (int, float, complex)
2832
2833
2834 try:
2835     compat_integer_types = (int, long)
2836 except NameError:  # Python 3
2837     compat_integer_types = (int, )
2838
2839
2840 if sys.version_info < (2, 7):
2841     def compat_socket_create_connection(address, timeout, source_address=None):
2842         host, port = address
2843         err = None
2844         for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
2845             af, socktype, proto, canonname, sa = res
2846             sock = None
2847             try:
2848                 sock = socket.socket(af, socktype, proto)
2849                 sock.settimeout(timeout)
2850                 if source_address:
2851                     sock.bind(source_address)
2852                 sock.connect(sa)
2853                 return sock
2854             except socket.error as _:
2855                 err = _
2856                 if sock is not None:
2857                     sock.close()
2858         if err is not None:
2859             raise err
2860         else:
2861             raise socket.error('getaddrinfo returns an empty list')
2862 else:
2863     compat_socket_create_connection = socket.create_connection
2864
2865
2866 # Fix https://github.com/ytdl-org/youtube-dl/issues/4223
2867 # See http://bugs.python.org/issue9161 for what is broken
2868 def workaround_optparse_bug9161():
2869     op = optparse.OptionParser()
2870     og = optparse.OptionGroup(op, 'foo')
2871     try:
2872         og.add_option('-t')
2873     except TypeError:
2874         real_add_option = optparse.OptionGroup.add_option
2875
2876         def _compat_add_option(self, *args, **kwargs):
2877             enc = lambda v: (
2878                 v.encode('ascii', 'replace') if isinstance(v, compat_str)
2879                 else v)
2880             bargs = [enc(a) for a in args]
2881             bkwargs = dict(
2882                 (k, enc(v)) for k, v in kwargs.items())
2883             return real_add_option(self, *bargs, **bkwargs)
2884         optparse.OptionGroup.add_option = _compat_add_option
2885
2886
2887 if hasattr(shutil, 'get_terminal_size'):  # Python >= 3.3
2888     compat_get_terminal_size = shutil.get_terminal_size
2889 else:
2890     _terminal_size = collections.namedtuple('terminal_size', ['columns', 'lines'])
2891
2892     def compat_get_terminal_size(fallback=(80, 24)):
2893         columns = compat_getenv('COLUMNS')
2894         if columns:
2895             columns = int(columns)
2896         else:
2897             columns = None
2898         lines = compat_getenv('LINES')
2899         if lines:
2900             lines = int(lines)
2901         else:
2902             lines = None
2903
2904         if columns is None or lines is None or columns <= 0 or lines <= 0:
2905             try:
2906                 sp = subprocess.Popen(
2907                     ['stty', 'size'],
2908                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
2909                 out, err = sp.communicate()
2910                 _lines, _columns = map(int, out.split())
2911             except Exception:
2912                 _columns, _lines = _terminal_size(*fallback)
2913
2914             if columns is None or columns <= 0:
2915                 columns = _columns
2916             if lines is None or lines <= 0:
2917                 lines = _lines
2918         return _terminal_size(columns, lines)
2919
2920 try:
2921     itertools.count(start=0, step=1)
2922     compat_itertools_count = itertools.count
2923 except TypeError:  # Python 2.6
2924     def compat_itertools_count(start=0, step=1):
2925         n = start
2926         while True:
2927             yield n
2928             n += step
2929
2930 if sys.version_info >= (3, 0):
2931     from tokenize import tokenize as compat_tokenize_tokenize
2932 else:
2933     from tokenize import generate_tokens as compat_tokenize_tokenize
2934
2935
2936 try:
2937     struct.pack('!I', 0)
2938 except TypeError:
2939     # In Python 2.6 and 2.7.x < 2.7.7, struct requires a bytes argument
2940     # See https://bugs.python.org/issue19099
2941     def compat_struct_pack(spec, *args):
2942         if isinstance(spec, compat_str):
2943             spec = spec.encode('ascii')
2944         return struct.pack(spec, *args)
2945
2946     def compat_struct_unpack(spec, *args):
2947         if isinstance(spec, compat_str):
2948             spec = spec.encode('ascii')
2949         return struct.unpack(spec, *args)
2950
2951     class compat_Struct(struct.Struct):
2952         def __init__(self, fmt):
2953             if isinstance(fmt, compat_str):
2954                 fmt = fmt.encode('ascii')
2955             super(compat_Struct, self).__init__(fmt)
2956 else:
2957     compat_struct_pack = struct.pack
2958     compat_struct_unpack = struct.unpack
2959     if platform.python_implementation() == 'IronPython' and sys.version_info < (2, 7, 8):
2960         class compat_Struct(struct.Struct):
2961             def unpack(self, string):
2962                 if not isinstance(string, buffer):  # noqa: F821
2963                     string = buffer(string)  # noqa: F821
2964                 return super(compat_Struct, self).unpack(string)
2965     else:
2966         compat_Struct = struct.Struct
2967
2968
2969 # compat_map/filter() returning an iterator, supposedly the
2970 # same versioning as for zip below
2971 try:
2972     from future_builtins import map as compat_map
2973 except ImportError:
2974     try:
2975         from itertools import imap as compat_map
2976     except ImportError:
2977         compat_map = map
2978
2979 try:
2980     from future_builtins import filter as compat_filter
2981 except ImportError:
2982     try:
2983         from itertools import ifilter as compat_filter
2984     except ImportError:
2985         compat_filter = filter
2986
2987
2988 try:
2989     from future_builtins import zip as compat_zip
2990 except ImportError:  # not 2.6+ or is 3.x
2991     try:
2992         from itertools import izip as compat_zip  # < 2.5 or 3.x
2993     except ImportError:
2994         compat_zip = zip
2995
2996
2997 if sys.version_info < (3, 3):
2998     def compat_b64decode(s, *args, **kwargs):
2999         if isinstance(s, compat_str):
3000             s = s.encode('ascii')
3001         return base64.b64decode(s, *args, **kwargs)
3002 else:
3003     compat_b64decode = base64.b64decode
3004
3005
3006 if platform.python_implementation() == 'PyPy' and sys.pypy_version_info < (5, 4, 0):
3007     # PyPy2 prior to version 5.4.0 expects byte strings as Windows function
3008     # names, see the original PyPy issue [1] and the youtube-dl one [2].
3009     # 1. https://bitbucket.org/pypy/pypy/issues/2360/windows-ctypescdll-typeerror-function-name
3010     # 2. https://github.com/ytdl-org/youtube-dl/pull/4392
3011     def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
3012         real = ctypes.WINFUNCTYPE(*args, **kwargs)
3013
3014         def resf(tpl, *args, **kwargs):
3015             funcname, dll = tpl
3016             return real((str(funcname), dll), *args, **kwargs)
3017
3018         return resf
3019 else:
3020     def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
3021         return ctypes.WINFUNCTYPE(*args, **kwargs)
3022
3023
3024 __all__ = [
3025     'compat_HTMLParseError',
3026     'compat_HTMLParser',
3027     'compat_HTTPError',
3028     'compat_Struct',
3029     'compat_b64decode',
3030     'compat_basestring',
3031     'compat_chr',
3032     'compat_collections_abc',
3033     'compat_cookiejar',
3034     'compat_cookiejar_Cookie',
3035     'compat_cookies',
3036     'compat_cookies_SimpleCookie',
3037     'compat_ctypes_WINFUNCTYPE',
3038     'compat_etree_Element',
3039     'compat_etree_fromstring',
3040     'compat_etree_register_namespace',
3041     'compat_expanduser',
3042     'compat_filter',
3043     'compat_get_terminal_size',
3044     'compat_getenv',
3045     'compat_getpass',
3046     'compat_html_entities',
3047     'compat_html_entities_html5',
3048     'compat_http_client',
3049     'compat_http_server',
3050     'compat_input',
3051     'compat_integer_types',
3052     'compat_itertools_count',
3053     'compat_kwargs',
3054     'compat_map',
3055     'compat_numeric_types',
3056     'compat_ord',
3057     'compat_os_name',
3058     'compat_parse_qs',
3059     'compat_print',
3060     'compat_realpath',
3061     'compat_setenv',
3062     'compat_shlex_quote',
3063     'compat_shlex_split',
3064     'compat_socket_create_connection',
3065     'compat_str',
3066     'compat_struct_pack',
3067     'compat_struct_unpack',
3068     'compat_subprocess_get_DEVNULL',
3069     'compat_tokenize_tokenize',
3070     'compat_urllib_error',
3071     'compat_urllib_parse',
3072     'compat_urllib_parse_unquote',
3073     'compat_urllib_parse_unquote_plus',
3074     'compat_urllib_parse_unquote_to_bytes',
3075     'compat_urllib_parse_urlencode',
3076     'compat_urllib_parse_urlparse',
3077     'compat_urllib_request',
3078     'compat_urllib_request_DataHandler',
3079     'compat_urllib_response',
3080     'compat_urlparse',
3081     'compat_urlretrieve',
3082     'compat_xml_parse_error',
3083     'compat_xpath',
3084     'compat_zip',
3085     'workaround_optparse_bug9161',
3086 ]