youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

compat.py (94259B)


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