#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Almacen de valores de uso comun"""

try:
    from pymetrick.version import __author__, __version__, __license__, __copyright__
except ImportError:
    raise ImportError(
        'Failed to find (autogenerated) version.py '
    )

__date__ = '2012-09-21'
__credits__ = ''
__text__ = 'Almacen de valores de uso comun'
__file__ = 'common.py'

import sys
# sin bytecode
sys.dont_write_bytecode = True

# Version PY
PY2 = True if sys.version[:1] == 2 else False;
PY3 = True if sys.version[:1] == 3 else False;

if PY2:
    # python3 chr & python2 unichr
    chr = unichr
    
if PY3:
    long = int

# Date/time conversion
EPOCH_YEAR = 1970

_weekdayname = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
_weekdayname_es = ["Lun", "Mar", "Mie", "Jue", "Vie", "Sab", "Dom"]

_monthname = [None, # Dummy so we can use 1-based month numbers
              "Jan", "Feb", "Mar", "Apr", "May", "Jun",
              "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

_monthname_es = [None, # Para usar como base del primer mes 1
              "Ene", "Feb", "Mar", "Abr", "May", "Jun",
              "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"]

_long_dayname = ['monday','tuesday','wednesday',
             'thursday','friday','saturday','sunday']

_long_dayname_es = ['lunes',u'martes',u'miercoles',
             'jueves','fiernes','sabado','domingo']

"""CIF intracomunitario"""
"""
VIES = {'AT':,'BG':,'BE':,'CY':,'CZ':,'DE':,'DK':,'EE':,'EL':,'ES':,'FI':,'FR':,'FI':,'FR':,'GB':,'HR':'HU':,'IE':,'IT':,'LT':,'LU':,'LV':,'MT':,'NL':,'PL':,'PT':,'RO':,'SE':,'SI':,'SK':}
"""
"""
VAT identification number structure (ES)
Estado Miembro 	Structure (ES) 	Format (ES)*
AT-Austria 	ATU99999999 	1 block of 9 characters (es)
BE-Bélgica 	BE0999999999 	1 block of 10 digits
BG-Bulgaria 	BG999999999 or
BG9999999999 (es) 	1 block of 9 digits or1 block of 10 digits (es)
CY-Chipre 	CY99999999L 	1 block of 9 characters (es)
CZ-Chequia 	CZ99999999 or
CZ999999999 or
CZ9999999999
(es) 	1 block of either 8, 9 or 10 digits (es)
DE-Alemania 	DE999999999 	1 block of 9 digits (es)
DK-Dinamarca 	DK99 99 99 99 	4 blocks of 2 digits (es)
EE-Estonia 	EE999999999 	1 block of 9 digits (es)
EL-Grecia 	EL999999999 	1 block of 9 digits (es)
ES-España 	ESX9999999X4 	1 block of 9 characters (es)
FI-Finlandia 	FI99999999 	1 block of 8 digits (es)
FR-Francia 	FRXX 999999999 	1 block of 2 characters, 1 block of 9 digits (es)
GB-Reino Unido 	GB999 9999 99 or
GB999 9999 99 9995 or
GBGD9996 or
GBHA9997 (es) 	1 block of 3 digits, 1 block of 4 digits and 1 block of 2 digits; or the above followed by a block of 3 digits; or 1 block of 5 characters (es)
HR-Croacia 	HR99999999999 	1 block of 11 digits
HU-Hungría 	HU99999999 	1 block of 8 digits (es)
IE-Irlanda 	IE9S99999L
IE9999999WI 	1 block of 8 characters or 1 block of 9 characters
IT-Italia 	IT99999999999 	1 block of 11 digits (es)
LT-Lituania 	LT999999999 or
LT999999999999 (es) 	1 block of 9 digits, or 1 block of 12 digits (es)
LU-Luxemburgo 	LU99999999 	1 block of 8 digits (es)
LV-Letonia 	LV99999999999 	1 block of 11 digits (es)
MT-Malta 	MT99999999 	1 block of 8 digits (es)
NL-Países Bajos 	NL999999999B998 	1 block of 12 characters (es)
PL-Polonia 	PL9999999999 	1 block of 10 digits (es)
PT-Portugal 	PT999999999 	1 block of 9 digits (es)
RO-Rumania 	RO999999999 	1 block of minimum 2 digits and maximum 10 digits (es)
SE-Suecia 	SE999999999999 	1 block of 12 digits (es)
SI-Eslovenia 	SI99999999 	1 block of 8 digits (es)
SK-Eslovaquia 	SK9999999999 	1 block of 10 digits (es)

Remarks:
*: Format excludes 2 letter alpha prefix
9: A digit
X: A letter or a digit
S: A letter; a digit; "+" or "*"
L: A letter (ES)

Notes:
1: The 1st position following the prefix is always "U".
2: The first digit following the prefix is always zero ('0').
3: The (new) 10-digit format is the result of adding a leading zero to the (old) 9-digit format.
4: The first and last characters may be alpha or numeric; but they may not both be numeric.
5: Identifies branch traders.
6: Identifies Government Departments.
7: Identifies Health Authorities.
8: The 10th position following the prefix is always "B". (ES)
"""

"""Match user agent string"""

OS_LIST= {'01 WinCE':'Windows Mobile Phones',
          '02 Windows CE':'Windows Mobile Phones',
          '03 Windows Phone OS':'Windows Mobile Phones',
          '04 Windows Phone 8.0':'Windows Phone',
          '05 Win16':'Windows 3.11',
          '06 Windows 95':'Windows 95',
          '07 Win95':'Windows 95',
          '08 Windows_95':'Windows 95',
          '09 Windows 98':'Windows 98',
          '10 Win98':'Windows 98',
          '11 Windows NT 5.0':'Windows 2000',
          '12 Windows 2000':'Windows 2000',
          '13 Windows NT 5.1':'Windows XP',
          '14 Windows XP':'Windows XP',
          '15 Windows NT 5.2':'Windows Server 2003',
          '16 Windows NT 6.0':'Windows Vista',
          '17 Windows NT 6.1':'Windows 7',
          '18 Windows NT 6.2':'Windows 8',
          '19 Windows NT 4.0':'Windows NT 4.0',
          '20 WinNT4.0':'Windows NT 4.0',
          '21 WinNT':'Windows NT 4.0',
          '22 Windows NT':'Windows NT 4.0',
          '23 Windows ME':'Windows ME',
          '24 OpenBSD':'Open BSD',
          '25 SunOS':'Sun OS',
          '26 Mac_PowerPC':'Mac OS',
          '27 Macintosh':'Mac OS',
          '28 MAC OS X':'Mac OS',
          '29 OS X':'Mac OS',
          '30 iPhone':'iOS',
          '31 iPad':'iOS',
          '32 iPod':'iOS',
          '33 Apple\'s mobile/tablet':'iOS',
          '34 QNX':'QNX',
          '35 BeOS':'BeOS',
          '36 OS/2':'OS/2',
          '37 BlackBerry':'BlackBerry',
          '38 Android':'Android',
          '39 Linux':'Linux',
          '40 X11':'Linux',
          '41 Symbian OS':'Symbian',
          '42 SymbianOS':'Symbian',
          '43 Symbian':'Symbian',
          '44 SymbOS':'Symbian',
          '45 EPOC':'Symbian',
          '46 J2ME/MIDP':'Java Mobile Phones (J2ME)',
          '47 J2ME':'Java Mobile Phones (J2ME)',
          '48 JavaME':'Java Mobile Phones (J2ME)',
          '49 JavaFX':'JavaFX Mobile Phones',
          '50 Bada':'Bada',
          '51 PalmOS':'HP/Palm Os',
          '52 WebOS':'HP/Palm OS',
          '53 NetBSD':'NetBSD',
          '54 AmigaOS':'AmigaOS',
          '55 Darwin':'Darwin (Macintosh)',
          '56 OpenVMS':'OpenVMS',
          '57 Haik':'Haiku/BeOS',
          '58 Solaris':'Solaris',
          '59 (Mobile; rv:':'Firefox OS',
          '60 Spider':'Bot',
          '61 Bot':'Bot',
          '62 Ezooms':'Bot',
          '63 YandexBot':'Bot',
          '64 AhrefsBot':'Bot',
          '65 nuhk':'Bot',
          '66 Googlebot':'Bot',
          '67 bingbot':'Bot',
          '68 Yahoo':'Bot',
          '69 Lycos':'Bot',
          '70 Scooter':'Bot',
          '71 AltaVista':'Bot',
          '72 Gigabot':'Bot',
          '73 Googlebot-Mobile':'Bot',
          '74 Yammybot':'Bot',
          '75 Openbot':'Bot',
          '76 Slurp/cat':'Bot',
          '77 MSNBot':'Bot',
          '78 ia_archiver':'Bot',
          '79 Ask Jeeves/Teoma':'Bot',
          '80 Java/1.6.0_04':'Bot',
          '81 Internet Search Engine':'Bot',
          '82 Googlebot-Mobile':'Bot Mobile'
          }

BROWSER_LIST = {'01 msie 3':'IE 3',
                '02 msie 4':'IE 4',
                '03 msie 5.5':'IE 5.5',
                '04 msie 5.01':'IE 5.01',
                '05 msie 5.5':'IE 5.5',
                '06 msie 6.0':'IE 6.0',
                '07 msie 7.0':'IE 7.0',
                '08 msie 9.0':'IE 9.0',
                '09 msie 10.0':' IE 10.0',
                '10 iemobile':'IE Mobile',
                '11 msie':'ie ?',
                '12 opera mini':'Opera Mini',
                '13 opera mobi':'Opera Mobi',
                '14 opera':'Opera',
                '15 firefox':'Firefox',
                '16 seamonkey':'Seamonkey',
                '17 ChromePlus':'ChromePlus',
                '18 Chrome':'Chrome',
                '19 Safari':'Safari',
                '20 Midori':'Midori',
                '21 mozilla/3':'netscape 3',
                '22 mozilla/4.08':'netscape 4.08',
                '23 mozilla/4.7':'netscape 4.7',
                '24 mozilla/4.78':'netscape 4.78',
                '25 netscape6':'netscape 6',
                '26 mozilla/7.0':'netscape 7',
                '27 mozilla':'netscape ?',
                '28 UP.Browser':'UP.Browser',
                '29 Dolfin':'Dolfin',
                '30 EudoraWeb':'Eudora',
                '31 Blazer':'Blazer',
                '32 NetFront':'NetFront',
                '33 Amaya':'Amaya',
                '34 Science Traveller International':'Science Traveller International',
                '35 Dillo':'Dillo',
                '36 ELinks':'textmode',
                '37 IBrowse':'IBrowse',
                '38 Mosaic':'Mosaic',
                '39 ICE Browser':'ICE Browser',
                '40 Konqueror':'Konqueror',
                '41 Links':'textmode',
                '42 Lynx':'textmode',
                '43 muCommander':'muCommander',
                '44 Oregano':'Oregano',
                '45 Bison':'Bot',
                '46 retawq':'textmode',
                '47 AWeb':'AWeb (Amiga)',
                '48 Chimera':'Chimera',
                '49 NetSurf':'NetSurf'}

ENGINE_LIST = {'01 Gecko':'Gecko','02 webkit':'03 AppleWebKit','04 presto':'Opera','05 trident':'Trident','06 Java':'Java'}

DEVICE_LIST = {'01 tablet':'Tablet',
               '02 iPad':'Tablet',
               '03 Android 3':'Tablet',
               '04 Xoom':'Tablet',
               '05 GT-P1000':'Tablet',
               '06 SGH-T849':'Tablet',
               '07 SHW-M180S':'Tablet',
               '08 Kindle':'Tablet',
               '09 Silk':'Tablet',
               '10 NOOK':'Tablet',
               '11 GT-B5310':'Mobile',
               '12 iPhone':'Mobile',
               '13 iPod':'Mobile',
               '14 BlackBerry':'Mobile',
               '15 Android':'Mobile',
               '16 Symbian':'Mobile',
               '17 OPWV-SDK':'Mobile',
               '18 XBLWP7':'Mobile',
               '19 Bada':'Mobile',
               '20 WinCE':'Mobile',
               '21 Windows CE':'Mobile',
               '22 Windows Phone OS':'Mobile',
               '23 Windows Phone':'Mobile',
               '24 PalmOS':'Mobile',
               '25 PlayStation Portable':'Mobile',
               '26 PSP':'Mobile',
               '27 WebOS':'Mobile',
               '28 Palm':'Mobile',
               '29 PDA':'Mobile',
               '30 Google Wireless Transcoder':'Mobile',
               '31 SonyEricsson':'Mobile',
               '32 Nintendo Wii':'Desktop',
               '33 PLAYSTATION 3':'Desktop',
               '34 PS2':'Desktop',
               '35 AmigaOS':'Desktop',
               '36 Nintendo 3DS':'Mobile',
               '37 MIDP':'Mobile',
               '38 (Mobile; rv:':'Mobile',
               '39 mobi':'Mobile' }

STATUS_CODE   = {'200':'200 OK',
                 '201':'201 Created',
                 '202':'202 Accepted',
                 '204':'204 No Content',
                 '206':'206 Partial Content',
                 '400':'400 Bad Request',
                 '401':'401 Unauthorized',
                 '402':'402 Payment Required',
                 '403':'403 Forbidden',
                 '404':'404 Not Found',
                 '405':'405 Method Not Allowed',
                 '406':'406 Not Acceptable',
                 '408':'408 Request Timeout',
                 '500':'500 Server Error'}

LANGUAGE_LIST = {'af' : 'Afrikaans',
                 'sq' : 'Albanian',
                 'ar-dz' : 'Arabic (Algeria)',
                 'ar-bh' : 'Arabic (Bahrain)',
                 'ar-eg' : 'Arabic (Egypt)',
                 'ar-iq' : 'Arabic (Iraq)',
                 'ar-jo' : 'Arabic (Jordan)',
                 'ar-kw' : 'Arabic (Kuwait)',
                 'ar-lb' : 'Arabic (Lebanon)',
                 'ar-ly' : 'Arabic (libya)',
                 'ar-ma' : 'Arabic (Morocco)',
                 'ar-om' : 'Arabic (Oman)',
                 'ar-qa' : 'Arabic (Qatar)',
                 'ar-sa' : 'Arabic (Saudi Arabia)',
                 'ar-sy' : 'Arabic (Syria)',
                 'ar-tn' : 'Arabic (Tunisia)',
                 'ar-ae' : 'Arabic (U.A.E.)',
                 'ar-ye' : 'Arabic (Yemen)',
                 'ar' : 'Arabic',
                 'hy' : 'Armenian',
                 'as' : 'Assamese',
                 'az' : 'Azeri',
                 'e' : 'Basque',
                 'be' : 'Belarusian',
                 'bn' : 'Bengali',
                 'bg' : 'Bulgarian',
                 'ca' : 'Catalan',
                 'zh-cn' : 'Chinese (China)',
                 'zh-hk' : 'Chinese (Hong Kong SAR)',
                 'zh-mo' : 'Chinese (Macau SAR)',
                 'zh-sg' : 'Chinese (Singapore)',
                 'zh-tw' : 'Chinese (Taiwan)',
                 'zh' : 'Chinese',
                 'hr' : 'Croatian',
                 'cs' : 'Czech',
                 'da' : 'Danish',
                 'div' : 'Divehi',
                 'nl-be' : 'Dutch (Belgium)',
                 'nl' : 'Dutch (Netherlands)',
                 'en-a' : 'English (Australia)',
                 'en-bz' : 'English (Belize)',
                 'en-ca' : 'English (Canada)',
                 'en-ie' : 'English (Ireland)',
                 'en-jm' : 'English (Jamaica)',
                 'en-nz' : 'English (New Zealand)',
                 'en-ph' : 'English (Philippines)',
                 'en-za' : 'English (South Africa)',
                 'en-tt' : 'English (Trinidad)',
                 'en-gb' : 'English (United Kingdom)',
                 'en-us' : 'English (United States)',
                 'en-zw' : 'English (Zimbabwe)',
                 'en' : 'English',
                 'us' : 'English (United States)',
                 'et' : 'Estonian',
                 'fo' : 'Faeroese',
                 'fa' : 'Farsi',
                 'fi' : 'Finnish',
                 'fr-be' : 'French (Belgium)',
                 'fr-ca' : 'French (Canada)',
                 'fr-l' : 'French (Luxembourg)',
                 'fr-mc' : 'French (Monaco)',
                 'fr-ch' : 'French (Switzerland)',
                 'fr' : 'French (France)',
                 'mk' : 'FYRO Macedonian',
                 'gd' : 'Gaelic',
                 'ka' : 'Georgian',
                 'de-at' : 'German (Austria)',
                 'de-li' : 'German (Liechtenstein)',
                 'de-l' : 'German (Luxembourg)',
                 'de-ch' : 'German (Switzerland)',
                 'de' : 'German (Germany)',
                 'el' : 'Greek',
                 'g' : 'Gujarati',
                 'he' : 'Hebrew',
                 'hi' : 'Hindi',
                 'h' : 'Hungarian',
                 'is' : 'Icelandic',
                 'id' : 'Indonesian',
                 'it-ch' : 'Italian (Switzerland)',
                 'it' : 'Italian (Italy)',
                 'ja' : 'Japanese',
                 'kn' : 'Kannada',
                 'kk' : 'Kazakh',
                 'kok' : 'Konkani',
                 'ko' : 'Korean',
                 'kz' : 'Kyrgyz',
                 'lv' : 'Latvian',
                 'lt' : 'Lithuanian',
                 'ms' : 'Malay',
                 'ml' : 'Malayalam',
                 'mt' : 'Maltese',
                 'mr' : 'Marathi',
                 'mn' : 'Mongolian (Cyrillic)',
                 'ne' : 'Nepali (India)',
                 'nb-no' : 'Norwegian (Bokmal)',
                 'nn-no' : 'Norwegian (Nynorsk)',
                 'no' : 'Norwegian (Bokmal)',
                 'or' : 'Oriya',
                 'pl' : 'Polish',
                 'pt-br' : 'Portuguese (Brazil)',
                 'pt' : 'Portuguese (Portugal)',
                 'pa' : 'Punjabi',
                 'rm' : 'Rhaeto-Romanic',
                 'ro-md' : 'Romanian (Moldova)',
                 'ro' : 'Romanian',
                 'ru-md' : 'Russian (Moldova)',
                 'r' : 'Russian',
                 'sa' : 'Sanskrit',
                 'sr' : 'Serbian',
                 'sk' : 'Slovak',
                 'ls' : 'Slovenian',
                 'sb' : 'Sorbian',
                 'es-ar' : 'Spanish (Argentina)',
                 'es-bo' : 'Spanish (Bolivia)',
                 'es-cl' : 'Spanish (Chile)',
                 'es-co' : 'Spanish (Colombia)',
                 'es-cr' : 'Spanish (Costa Rica)',
                 'es-do' : 'Spanish (Dominican Republic)',
                 'es-ec' : 'Spanish (Ecuador)',
                 'es-sv' : 'Spanish (El Salvador)',
                 'es-gt' : 'Spanish (Guatemala)',
                 'es-hn' : 'Spanish (Honduras)',
                 'es-mx' : 'Spanish (Mexico)',
                 'es-ni' : 'Spanish (Nicaragua)',
                 'es-pa' : 'Spanish (Panama)',
                 'es-py' : 'Spanish (Paraguay)',
                 'es-pe' : 'Spanish (Peru)',
                 'es-pr' : 'Spanish (Puerto Rico)',
                 'es-es' : 'Spanish (Spain)',
                 'es-us' : 'Spanish (United States)',
                 'es-uy' : 'Spanish (Uruguay)',
                 'es-ve' : 'Spanish (Venezuela)',
                 'es' : 'Spanish (Traditional Sort)',
                 'sx' : 'Sut',
                 'sw' : 'Swahili',
                 'sv-fi' : 'Swedish (Finland)',
                 'sv' : 'Swedish',
                 'syr' : 'Syriac',
                 'ta' : 'Tamil',
                 'tt' : 'Tatar',
                 'te' : 'Telug',
                 'th' : 'Thai',
                 'ts' : 'Tsonga',
                 'tn' : 'Tswana',
                 'tr' : 'Turkish',
                 'uk' : 'Ukrainian',
                 'ur' : 'Urd',
                 'uz' : 'Uzbek',
                 'vi' : 'Vietnamese',
                 'xh' : 'Xhosa',
                 'yi' : 'Yiddish',
                 'z' : 'Zul'}

COUNTRY_CODES = (
    '',
    'AP','E','AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ',
    'AR','AS','AT','AU','AW','AZ','BA','BB','BD','BE','BF','BG',
    'BH','BI','BJ','BM','BN','BO','BR','BS','BT','BV','BW','BY',
    'BZ','CA','CC','CD','CF','CG','CH','CI','CK','CL','CM','CN',
    'CO','CR','CU','CV','CX','CY','CZ','DE','DJ','DK','DM','DO',
    'DZ','EC','EE','EG','EH','ER','ES','ET','FI','FJ','FK','FM',
    'FO','FR','FX','GA','GB','GD','GE','GF','GH','GI','GL','GM',
    'GN','GP','GQ','GR','GS','GT','GU','GW','GY','HK','HM','HN',
    'HR','HT','HU','ID','IE','IL','IN','IO','IQ','IR','IS','IT',
    'JM','JO','JP','KE','KG','KH','KI','KM','KN','KP','KR','KW',
    'KY','KZ','LA','LB','LC','LI','LK','LR','LS','LT','LU','LV',
    'LY','MA','MC','MD','MG','MH','MK','ML','MM','MN','MO','MP',
    'MQ','MR','MS','MT','MU','MV','MW','MX','MY','MZ','NA','NC',
    'NE','NF','NG','NI','NL','NO','NP','NR','NU','NZ','OM','PA',
    'PE','PF','PG','PH','PK','PL','PM','PN','PR','PS','PT','PW',
    'PY','QA','RE','RO','RU','RW','SA','SB','SC','SD','SE','SG',
    'SH','SI','SJ','SK','SL','SM','SN','SO','SR','ST','SV','SY',
    'SZ','TC','TD','TF','TG','TH','TJ','TK','TM','TN','TO','TL',
    'TR','TT','TV','TW','TZ','UA','UG','UM','US','UY','UZ','VA',
    'VC','VE','VG','VI','VN','VU','WF','WS','YE','YT','RS','ZA',
    'ZM','ME','ZW','A1','A2','O1','AX','GG','IM','JE','BL','MF'
)

COUNTRY_CODES3 = (
    '','AP','EU','AND','ARE','AFG','ATG','AIA','ALB','ARM','ANT',
    'AGO','AQ','ARG','ASM','AUT','AUS','ABW','AZE','BIH','BRB','BGD',
    'BEL','BFA','BGR','BHR','BDI','BEN','BMU','BRN','BOL','BRA',
    'BHS','BTN','BV','BWA','BLR','BLZ','CAN','CC','COD','CAF','COG',
    'CHE','CIV','COK','CHL','CMR','CHN','COL','CRI','CUB','CPV','CX',
    'CYP','CZE','DEU','DJI','DNK','DMA','DOM','DZA','ECU','EST',
    'EGY','ESH','ERI','ESP','ETH','FIN','FJI','FLK','FSM','FRO',
    'FRA','FX','GAB','GBR','GRD','GEO','GUF','GHA','GIB','GRL','GMB',
    'GIN','GLP','GNQ','GRC','GS','GTM','GUM','GNB','GUY','HKG','HM',
    'HND','HRV','HTI','HUN','IDN','IRL','ISR','IND','IO','IRQ','IRN',
    'ISL','ITA','JAM','JOR','JPN','KEN','KGZ','KHM','KIR','COM',
    'KNA','PRK','KOR','KWT','CYM','KAZ','LAO','LBN','LCA','LIE',
    'LKA','LBR','LSO','LTU','LUX','LVA','LBY','MAR','MCO','MDA',
    'MDG','MHL','MKD','MLI','MMR','MNG','MAC','MNP','MTQ','MRT',
    'MSR','MLT','MUS','MDV','MWI','MEX','MYS','MOZ','NAM','NCL',
    'NER','NFK','NGA','NIC','NLD','NOR','NPL','NRU','NIU','NZL',
    'OMN','PAN','PER','PYF','PNG','PHL','PAK','POL','SPM','PCN',
    'PRI','PSE','PRT','PLW','PRY','QAT','REU','ROU','RUS','RWA',
    'SAU','SLB','SYC','SDN','SWE','SGP','SHN','SVN','SJM','SVK',
    'SLE','SMR','SEN','SOM','SUR','STP','SLV','SYR','SWZ','TCA',
    'TCD','TF','TGO','THA','TJK','TKL','TLS','TKM','TUN','TON','TUR',
    'TTO','TUV','TWN','TZA','UKR','UGA','UM','USA','URY','UZB','VAT',
    'VCT','VEN','VGB','VIR','VNM','VUT','WLF','WSM','YEM','YT','SRB',
    'ZAF','ZMB','MNE','ZWE','A1','A2','O1','ALA','GGY','IMN','JEY',
    'BLM','MAF'
)

COUNTRY_NAMES = (
    "",'Asia/Pacific Region','Europe','Andorra','United Arab Emirates',
    'Afghanistan','Antigua and Barbuda','Anguilla','Albania','Armenia',
    'Netherlands Antilles','Angola','Antarctica','Argentina',
    'American Samoa','Austria','Australia','Aruba','Azerbaijan',
    'Bosnia and Herzegovina','Barbados','Bangladesh','Belgium',
    'Burkina Faso','Bulgaria','Bahrain','Burundi','Benin','Bermuda',
    'Brunei Darussalam','Bolivia','Brazil','Bahamas','Bhutan',
    'Bouvet Island','Botswana','Belarus','Belize','Canada',
    'Cocos (Keeling) Islands','Congo, The Democratic Republic of the',
    'Central African Republic','Congo','Switzerland',"Cote D\'Ivoire",
    'Cook Islands','Chile','Cameroon','China','Colombia','Costa Rica',
    'Cuba','Cape Verde','Christmas Island','Cyprus','Czech Republic',
    'Germany','Djibouti','Denmark','Dominica','Dominican Republic',
    'Algeria','Ecuador','Estonia','Egypt','Western Sahara','Eritrea',
    'Spain','Ethiopia','Finland','Fiji','Falkland Islands (Malvinas)',
    'Micronesia, Federated States of','Faroe Islands','France',
    'France, Metropolitan','Gabon','United Kingdom','Grenada','Georgia',
    'French Guiana','Ghana','Gibraltar','Greenland','Gambia','Guinea',
    'Guadeloupe','Equatorial Guinea','Greece',
    'South Georgia and the South Sandwich Islands','Guatemala','Guam',
    'Guinea-Bissa','Guyana','Hong Kong',
    'Heard Island and McDonald Islands','Honduras','Croatia','Haiti',
    'Hungary','Indonesia','Ireland','Israel','India',
    'British Indian Ocean Territory','Iraq','Iran, Islamic Republic of',
    'Iceland','Italy','Jamaica','Jordan','Japan','Kenya','Kyrgyzstan',
    'Cambodia','Kiribati','Comoros','Saint Kitts and Nevis',
    'Korea, Democratic People\'s Republic of','Korea, Republic of','Kuwait',
    'Cayman Islands','Kazakhstan','Lao People\'s Democratic Republic',
    'Lebanon','Saint Lucia','Liechtenstein','Sri Lanka','Liberia',
    'Lesotho','Lithuania','Luxembourg','Latvia','Libya','Morocco',
    'Monaco','Moldova, Republic of','Madagascar','Marshall Islands',
    'Macedonia','Mali','Myanmar','Mongolia','Maca',
    'Northern Mariana Islands','Martinique','Mauritania','Montserrat',
    'Malta','Mauritius','Maldives','Malawi','Mexico','Malaysia',
    'Mozambique','Namibia','New Caledonia','Niger','Norfolk Island',
    'Nigeria','Nicaragua','Netherlands','Norway','Nepal','Naur','Niue',
    'New Zealand','Oman','Panama','Per','French Polynesia',
    'Papua New Guinea','Philippines','Pakistan','Poland',
    'Saint Pierre and Miquelon','Pitcairn Islands','Puerto Rico',
    'Palestinian Territory','Portugal','Pala','Paraguay','Qatar',
    'Reunion','Romania','Russian Federation','Rwanda','Saudi Arabia',
    'Solomon Islands','Seychelles','Sudan','Sweden','Singapore',
    'Saint Helena','Slovenia','Svalbard and Jan Mayen','Slovakia',
    'Sierra Leone','San Marino','Senegal','Somalia','Suriname',
    'Sao Tome and Principe','El Salvador','Syrian Arab Republic',
    'Swaziland','Turks and Caicos Islands','Chad',
    'French Southern Territories','Togo','Thailand','Tajikistan','Tokela',
    'Turkmenistan','Tunisia','Tonga','Timor-Leste','Turkey',
    'Trinidad and Tobago','Tuval','Taiwan','Tanzania, United Republic of',
    'Ukraine','Uganda','United States Minor Outlying Islands',
    'United States','Uruguay','Uzbekistan','Holy See (Vatican City State)',
    'Saint Vincent and the Grenadines','Venezuela','Virgin Islands, British',
    'Virgin Islands, U.S.','Vietnam','Vanuat','Wallis and Futuna','Samoa',
    'Yemen','Mayotte','Serbia','South Africa','Zambia','Montenegro',
    'Zimbabwe','Anonymous Proxy','Satellite Provider','Other',
    'Aland Islands','Guernsey','Isle of Man','Jersey','Saint Barthelemy',
    'Saint Martin'
)


COUNTRY_NAMES_ES = (
    "",u'Asia / Pacifico',u'Europa',u'Andorra',u'Emiratos Árabes Unidos',
    u'Afganistán',u'Antigua y Barbuda',u'Anguila',u'Albania',u'Armenia',
    u'Antillas Holandesas',u'Angola',u'Antártida',u'Argentina',
    u'Samoa Americana',u'Austria',u'Australia',u'Aruba',u'Azerbaiyán',
    u'Bosnia y Herzegovina',u'Barbados',u'Bangladesh',u'Bélgica',
    u'Burkina Faso',u'Bulgaria',u'Bahrein',u'Burundi',u'Benin',u'Bermuda',
    u'Brunei Darussalam',u'Bolivia',u'Brasil',u'Bahamas',u'Bután',
    u'Isla Bouvet',u'Botswana',u'Belarús',u'Belice',u'Canadá',
    u'Cocos (Keeling)',u'Congo, La República Democrática dMarfilel'
    u'Central African Republic',u'Congo',u'Suiza', u"Costa de Marfil",
    u'Islas Cook',u'Chile',u'Camerún',u'China',u'Colombia',u'Costa Rica',
    u'Cuba',u'Cabo Verde',u'Isla de Navidad',u'Chipre',u'República Checa',
    u'Alemania',u'Djibouti',u'Dinamarca',u'Dominica',u'República Dominicana',
    u'Argelia',u'Ecuador',u'Estonia',u'Egipto',u'Sáhara Occidental',u'Eritrea',
    u'España',u'Etiopía',u'Finlandia',u'Fiyi',u'Islas Malvinas',
    u'Micronesia, Estados Federados de',u'Islas Feroe',u'Francia',
    u'Francia, Metropolis',u'Gabón',u'Reino Unido',u'Granada',u'Georgia',
    u'Guayana Francesa',u'Ghana',u'Gibraltar',u'Groenlandia',u'Gambia',u'Guinea',
    u'Guadalupe',u'Guinea Ecuatorial',u'Grecia',
    u'Georgia del Sur y las Islas Sandwich del Sur',u'Guatemala',u'Guam',
    u'Guinea-Bissau',u'Guyana',u'Hong Kong',
    u'Islas Heard y McDonald',u'Honduras',u'Croacia',u'Haiti',
    u'Hungría',u'Indonesia',u'Irlanda',u'Israel',u'India',
    u'British Indian Ocean Territory',u'Irak',u'Irán, República Islámica de',
    u'Iceland',u'Italia',u'Jamaica',u'Jordan',u'Japón',u'Kenia',u'Kirguistán',
    u'Camboya',u'Kiribati',u'Comoras',u'San Cristóbal y Nevis',
    u'Corea, República Popular Democrática de',u'Corea del Sur',u'Kuwait',
    u'Islas Caimán',u'Kazajstán',u'Laos, Repùblica Democrática Popular de',
    u'Libano',u'Santa Lucía',u'Liechtenstein',u'Sri Lanka',u'Liberia',
    u'Lesotho',u'Lituania',u'Luxemburgo',u'Letonia',u'Libia',u'Marruecos',
    u'Monaco',u'Moldavia, República de',u'Madagascar',u'Islas Marshall',
    u'Macedonia',u'Mali',u'Myanmar',u'Mongolia',u'Macao',
    u'Islas Marianas del Norte',u'Martinica',u'Mauritania',u'Montserrat',
    u'Malta',u'Mauricio',u'Maldivas',u'Malawi',u'México',u'Malasia',
    u'Mozambique',u'Namibia',u'Nueva Caledonia',u'Niger',u'Isla Norfolk',
    u'Nigeria',u'Nicaragua',u'Holanda',u'Noruega',u'Nepal',u'Nauru',u'Niue',
    u'Nueva Zelanda',u'Omán',u'Panamá',u'Perú',u'La Polinesia francesa',
    u'Papúa Nueva Guinea',u'Filipinas' ,u'Pakistán',u'Polonia',
    u'San Pedri y Miquelon',u'Islas Pitcairn',u'Puerto Rico',
    u'Territorio palestino',u'Portugal',u'Palau',u'Paraguay',u'Qatar',
    u'Reunion',u'Rumanía',u'Rusia',u'Ruanda',u'Arabia Saudita',
    u'Islas Salomón',u'Seychelles',u'Sudán',u'Suecia',u'Singapur',
    u'Santa Elena',u'Eslovenia',u'Svalbard y Jan Mayen',u'Eslovaquia',
    u'Sierra Leona',u'San Marino',u'Senegal',u'Somalia',u'Suriname',
    u'Santo Tomé y Príncipe',u'El Salvador',u'República Árabe Siria',
    u'Swazilandia',u'Turcas y Caicos',u'Chad',
    u'Territorios Australes Franceses',u'Togo',u'Tailandia',u'Tayikistán',u'Tokelau',
    u'Turkmenistán',u'Túnez',u'Tonga',u'Timor-Leste',u'Turquía',
    u'Trinidad y Tobago',u'Tuvalu',u'Taiwan',u'Tanzania, República Unida de'
    u'Ucrania',u'Uganda',u'Estados Unidos Islas menores alejadas',
    u'Estados Unidos',u'Uruguay',u'Uzbekistán',u'Santa Sede (Ciudad del Vaticano)',
    u'San Vicente y las Granadinas',u'Venezuela',u'Islas Vírgenes Británicas',
    u'Islas Vírgenes, EE.UU.',u'Vietnam',u'Vanuatu' ,u'Wallis y Futuna',u'Samoa',
    u'Yemen',u'Mayotte',u'Serbia',u'Sudáfrica',u'Zambia',u'Montenegro',
    u'Zimbabwe',u'Anonymous Proxy',u'Satelite',u'Otros',
    u'Islas de Aland',u'Guernsey',u'Isla de Man',u'Jersey',u'San Bartolomé',
    u'Saint Martin')


LATIN_DICT = {
            ord(u"Á") : u"&Aacute;",           # Á
            ord(u"É") : u"&Eacute;",           # É
            ord(u"Í") : u"&Iacute;",           # Í
            ord(u"Ó") : u"&Oacute;",           # Ó
            ord(u"Ú") : u"&Uacute;",           # Ú
            ord(u"Ñ") : u"&Ntilde;",           # Ñ
            ord(u"ñ") : u"&ntilde;",           # ñ
            ord(u"á") : u"&aacute;",           # á
            ord(u"é") : u"&eacute;",           # é
            ord(u"í") : u"&iacute;",           # í
            ord(u"ó") : u"&oacute;",           # ó
            ord(u"ú") : u"&uacute;",           # ú
            ord(u"Ü") : u"&Uuml;",             # Ü
            ord(u"ü") : u"&uuml;",             # ü
            ord(u"µ") : u"&Aacute;",           # Á
            ord(u"Ö") : u"&Iacute;",           # Í
            ord(u"à") : u"&Oacute;",           # Ó
            ord(u"é") : u"&Uacute;",           # Ú
            ord(u"¥") : u"&Ntilde;",           # Ñ
            ord(u"¤") : u"&ntilde;",           # ñ
            ord(u"á") : u"&aacute;",           # á
            ord(u"é") : u"&eacute;",           # é
            ord(u"¡") : u"&iacute;",           # í
            ord(u"¢") : u"&oacute;",           # ó
            ord(u"£") : u"&uacute;",           # ú
            ord(u"º") : u"&ordm;",             # º
            ord(u"§") : u"&ordm;",             # º
            ord(u"ª") : u"&ordf;",             # ª
            ord(u"¦") : u"&ordf;",             # ª
            ord(u",") : u"&#44;",              # , coma decimal
            ord(u"'") : u"&#39;",              # ' comilla o apostrofe
            ord(u"-") : u"&#45;",              # - menos o guion
            ord(u"ÿ") : u"&yuml;",             # y minuscula con dieresis
            ord(u"ï") : u"&iuml;",             # i minuscula con dieresis
          }


'''
KEYS
    NULL         = u'\ue000'
    CANCEL       = u'\ue001' #  ^break
    HELP         = u'\ue002'
    BACK_SPACE   = u'\ue003'
    TAB          = u'\ue004'
    CLEAR        = u'\ue005'
    RETURN       = u'\ue006'
    ENTER        = u'\ue007'
    SHIFT        = u'\ue008'
    LEFT_SHIFT   = u'\ue008' #  alias
    CONTROL      = u'\ue009'
    LEFT_CONTROL = u'\ue009' #  alias
    ALT          = u'\ue00a'
    LEFT_ALT     = u'\ue00a' #  alias
    PAUSE        = u'\ue00b'
    ESCAPE       = u'\ue00c'
    SPACE        = u'\ue00d'
    PAGE_UP      = u'\ue00e'
    PAGE_DOWN    = u'\ue00f'
    END          = u'\ue010'
    HOME         = u'\ue011'
    LEFT         = u'\ue012'
    ARROW_LEFT   = u'\ue012' # alias
    UP           = u'\ue013'
    ARROW_UP     = u'\ue013' # alias
    RIGHT        = u'\ue014'
    ARROW_RIGHT  = u'\ue014' #  alias
    DOWN         = u'\ue015'
    ARROW_DOWN   = u'\ue015' #  alias
    INSERT       = u'\ue016'
    DELETE       = u'\ue017'
    SEMICOLON    = u'\ue018'
    EQUALS       = u'\ue019'

    NUMPAD0      = u'\ue01a' #  numbe pad  keys
    NUMPAD1      = u'\ue01b'
    NUMPAD2      = u'\ue01c'
    NUMPAD3      = u'\ue01d'
    NUMPAD4      = u'\ue01e'
    NUMPAD5      = u'\ue01f'
    NUMPAD6      = u'\ue020'
    NUMPAD7      = u'\ue021'
    NUMPAD8      = u'\ue022'
    NUMPAD9      = u'\ue023'
    MULTIPLY     = u'\ue024'
    ADD          = u'\ue025'
    SEPARATOR    = u'\ue026'
    SUBTRACT     = u'\ue027'
    DECIMAL      = u'\ue028'
    DIVIDE       = u'\ue029'

    F1           = u'\ue031' #  function  keys
    F2           = u'\ue032'
    F3           = u'\ue033'
    F4           = u'\ue034'
    F5           = u'\ue035'
    F6           = u'\ue036'
    F7           = u'\ue037'
    F8           = u'\ue038'
    F9           = u'\ue039'
    F10          = u'\ue03a'
    F11          = u'\ue03b'
    F12          = u'\ue03c'

    META         = u'\ue03d'
    COMMAND      = u'\ue03d'
'''


'''
    Badbots

    WebBandit
    2icommerce
    Accoona
    ActiveTouristBot
    adressendeutschland
    aipbot
    Alexibot
    Alligator
    AllSubmitter
    almaden
    anarchie
    Anonymous
    Apexoo
    Aqua_Products
    asterias
    ASSORT
    ATHENS
    AtHome
    Atomz
    attache
    autoemailspider
    autohttp
    b2w
    bew
    BackDoorBot
    Badass
    Baiduspider
    Baiduspider+
    BecomeBot
    berts
    Bitacle
    Biz360
    Black.Hole
    BlackWidow
    bladder fusion
    Blog Checker
    BlogPeople
    Blogshares Spiders
    Bloodhound
    BlowFish
    Board Bot
    Bookmark search tool
    BotALot
    BotRightHere
    Bot mailto:craftbot@yahoo.com
    Bropwers
    Browsezilla
    BuiltBotTough
    Bullseye
    BunnySlippers
    Cegbfeieh
    CFNetwork
    CheeseBot
    CherryPicker
    Crescent
    charlotte/
    ChinaClaw
    Convera
    Copernic
    CopyRightCheck
    cosmos
    Crescent
    c-spider
    curl
    Custo
    Cyberz
    DataCha0s
    Daum
    Deweb
    Digger
    Digimarc
    digout4uagent
    DIIbot
    DISCo
    DittoSpyder
    DnloadMage
    Download
    dragonfly
    DreamPassport
    DSurf
    DTS Agent
    dumbot
    DynaWeb
    e-collector
    EasyDL
    EBrowse
    eCatch
    ecollector
    edgeio
    efp@gmx.net
    EirGrabber
    Email Extractor
    EmailCollector
    EmailSiphon
    EmailWolf
    EmeraldShield
    Enterprise_Search
    EroCrawler
    ESurf
    Eval
    Everest-Vulcan
    Exabot
    Express
    Extractor
    ExtractorPro
    EyeNetIE
    FairAd
    fastlwspider
    fetch
    FEZhead
    FileHound
    findlinks
    Flaming AttackBot
    FlashGet
    FlickBot
    Foobot
    Forex
    Franklin Locator
    FreshDownload
    FrontPage
    FSurf
    Gaisbot
    Gamespy_Arcade
    genieBot
    GetBot
    Getleft
    GetRight
    GetWeb!
    Go!Zilla
    Go-Ahead-Got-It
    GOFORITBOT
    GrabNet
    Grafula
    grub
    Harvest
    Hatena Antenna
    heritrix
    HLoader
    HMView
    holmes
    HooWWWer
    HouxouCrawler
    HTTPGet
    httplib
    HTTPRetriever
    HTTrack
    humanlinks
    IBM_Planetwide
    iCCrawler
    ichiro
    iGetter
    Image Stripper
    Image Sucker
    imagefetch
    imds_monitor
    IncyWincy
    Industry Program
    Indy
    InetURL
    InfoNaviRobot
    InstallShield DigitalWizard
    InterGET
    IRLbot
    Iron33
    ISSpider
    IUPUI Research Bot
    Jakarta
    java/
    JBH Agent
    JennyBot
    JetCar
    jeteye
    jeteyebot
    JoBo
    JOC Web Spider
    Kapere
    Kenjin
    Keyword Density
    KRetrieve
    ksoap
    KWebGet
    LapozzBot
    larbin
    leech
    LeechFTP
    LeechGet
    leipzig.de
    LexiBot
    libWeb
    libwww-FM
    libwww-perl
    LightningDownload
    LinkextractorPro
    Linkie
    LinkScan
    linktiger
    LinkWalker
    lmcrawler
    LNSpiderguy
    LocalcomBot
    looksmart
    LWP
    Mac Finder
    Mail Sweeper
    mark.blonin
    MaSagool
    Mass
    Mata Hari
    MCspider
    MetaProducts Download Express
    Microsoft Data Access
    Microsoft URL Control
    MIDown
    MIIxpc
    Mirror
    Missauga
    Missouri College Browse
    Mister
    Monster
    mkdb
    moget
    Moreoverbot
    mothra/netscan
    MovableType
    Mozi!
    Mozilla/22
    Mozilla/3.0 (compatible)
    Mozilla/5.0 (compatible; MSIE 5.0)
    MSIE_6.0
    MSIECrawler
    MSProxy
    MVAClient
    MyFamilyBot
    MyGetRight
    nameprotect
    NASA Search
    Naver
    Navroad
    NearSite
    NetAnts
    netattache
    NetCarta
    NetMechanic
    NetResearchServer
    NetSpider
    NetZIP
    Net Vampire
    NEWT ActiveX
    Nextopia
    NICErsPRO
    ninja
    NimbleCrawler
    noxtrumbot
    NPBot
    Octopus
    Offline
    OK Mozilla
    OmniExplorer
    OpaL
    Openbot
    Openfind
    OpenTextSiteCrawler
    Oracle Ultra Search
    OutfoxBot
    P3P
    PackRat
    PageGrabber
    PagmIEDownload
    panscient
    Papa Foto
    pavuk
    pcBrowser
    perl
    PerMan
    PersonaPilot
    PHP version
    PlantyNet_WebRobot
    playstarmusic
    Plucker
    Port Huron
    Program Shareware
    Progressive Download
    ProPowerBot
    prospector
    ProWebWalker
    Prozilla
    psbot
    psycheclone
    puf
    PushSite
    PussyCat
    PuxaRapido
    Python-urllib
    QuepasaCreep
    QueryN
    Radiation
    RealDownload
    RedCarpet
    RedKernel
    ReGet
    relevantnoise
    RepoMonkey
    RMA
    Rover
    Rsync
    RTG30
    Rufus
    SAPO
    SBIder
    scooter
    ScoutAbout
    script
    searchpreview
    searchterms
    Seekbot
    Serious
    Shai
    shelob
    Shim-Crawler
    SickleBot
    sitecheck
    SiteSnagger
    Slurpy Verifier
    SlySearch
    SmartDownload
    sna-
    snagger
    Snoopy
    sogou
    sootle
    So-net” bat_bot
    SpankBot” bat_bot
    spanner” bat_bot
    SpeedDownload
    Spegla
    Sphere
    Sphider
    SpiderBot
    sproose
    SQ Webscanner
    Sqworm
    Stamina
    Stanford
    studybot
    SuperBot
    SuperHTTP
    Surfbot
    SurfWalker
    suzuran
    Szukacz
    tAkeOut
    TALWinHttpClient
    tarspider
    Teleport
    Telesoft
    Templeton
    TestBED
    The Intraformant
    TheNomad
    TightTwatBot
    Titan
    toCrawl/UrlDispatcher
    True_Robot
    turingos
    TurnitinBot
    Twisted PageGetter
    UCmore
    UdmSearch
    UMBC
    UniversalFeedParser
    URL Control
    URLGetFile
    URLy Warning
    URL_Spider_Pro
    UtilMind
    vayala
    vobsub
    VCI
    VoidEYE
    VoilaBot
    voyager
    w3mir
    Web Image Collector
    Web Sucker
    Web2WAP
    WebaltBot
    WebAuto
    WebBandit
    WebCapture
    webcollage
    WebCopier
    WebCopy
    WebEMailExtrac
    WebEnhancer
    WebFetch
    WebFilter
    WebFountain
    WebGo
    WebLeacher
    WebMiner
    WebMirror
    WebReaper
    WebSauger
    WebSnake
    Website
    WebStripper
    WebVac
    webwalk
    WebWhacker
    WebZIP
    Wells Search
    WEP Search 00
    WeRelateBot
    Wget
    WhosTalking
    Widow
    Wildsoft Surfer
    WinHttpRequest
    WinHTTrack
    WUMPUS
    WWWOFFLE
    wwwster
    WWW-Collector
    Xaldon
    Xenu's
    Xenus
    XGET
    Y!TunnelPro
    YahooYSMcm
    YaDirectBot
    Yeti
    Zade
    ZBot
    zerxbot
    Zeus
    ZyBorg

'''
