moveable_map_revealer = 0
legionary = 1
archer = 4
hand_cannoneer = 5
elite_skirmisher = 6
skirmisher = 7
longbowman = 8
mangudai = 11
fishing_ship = 13
junk = 15
trade_cog = 17
war_galley = 21
crossbowman = 24
teutonic_knight = 25
bombard_cannon = 36
knight = 38
cavalry_archer = 39
cataphract = 40
huskarl = 41
trebuchet = 42
janissary = 46
royal_janissary = 52
fisherman = 56
chu_ko_nu = 73
militia = 74
man_at_arms = 75
long_swordsman = 77
villager_male = 83
spearman = 93
builder = 118
forager = 120
hunter = 122
lumberjack = 123
stone_miner = 124
monk = 125
trade_cart_empty = 128
repairer = 156
slinger = 185
flamethrower = 188
trade_cart_full = 204
imperial_camel_rider = 207
woad_raider = 232
war_elephant = 239
longboat = 250
farmer = 259
centurion = 275
scorpion = 279
mangonel = 280
throwing_axeman = 281
mameluke = 282
cavalier = 283
monk_with_relic = 286
samurai = 291
villager_female = 293
bandit = 299
llama = 305
camel_rider = 329
heavy_camel_rider = 330
trebuchet_packed = 331
pikeman = 358
halberdier = 359
norse_warrior = 361
cannon_galleon = 420
capped_ram = 422
king = 434
petard = 440
hussar = 441
galleon = 442
scout_cavalry = 448
two_handed_swordsman = 473
heavy_cavalry_archer = 474
arbalester = 492
heavy_crossbowman = 493
demolition_ship = 527
heavy_demolition_ship = 528
fire_ship = 529
elite_longbowman = 530
elite_throwing_axeman = 531
fast_fire_ship = 532
elite_longboat = 533
elite_woad_raider = 534
galley = 539
heavy_scorpion = 542
transport_ship = 545
light_cavalry = 546
siege_ram = 548
onager = 550
elite_cataphract = 553
elite_teutonic_knight = 554
elite_huskarl = 555
elite_mameluke = 556
elite_janissary = 557
elite_war_elephant = 558
elite_chu_ko_nu = 559
elite_samurai = 560
elite_mangudai = 561
champion = 567
paladin = 569
gold_miner = 579
siege_onager = 588
shepherd = 592
sheep = 594
penguin = 639
elite_cannon_galleon = 691
berserk = 692
elite_berserk = 694
cow_a = 705
jaguar_warrior = 725
elite_jaguar_warrior = 726
cobra_car = 748
eagle_scout = 751
elite_eagle_warrior = 752
eagle_warrior = 753
tarkan = 755
elite_tarkan = 757
plumed_archer = 763
elite_plumed_archer = 765
conquistador = 771
elite_conquistador = 773
missionary = 775
canoe = 778
horse_a = 814
amazon_warrior = 825
war_wagon = 827
elite_war_wagon = 829
turtle_ship = 831
elite_turtle_ship = 832
turkey = 833
donkey = 846
amazon_archer = 850
torch_a_convertable = 854
furious_the_monkey_boy = 860
genoese_crossbowman = 866
elite_genoese_crossbowman = 868
magyar_huszar = 869
elite_magyar_huszar = 871
elephant_archer = 873
elite_elephant_archer = 875
boyar = 876
elite_boyar = 878
kamayuk = 879
elite_kamayuk = 881
condottiero = 882
heavy_pikeman = 892
eastern_swordsman = 894
camel = 897
organ_gun = 1001
elite_organ_gun = 1003
caravel = 1004
elite_caravel = 1006
camel_archer = 1007
elite_camel_archer = 1009
genitour = 1010
elite_genitour = 1012
gbeto = 1013
elite_gbeto = 1015
shotel_warrior = 1016
elite_shotel_warrior = 1018
priest = 1023
goat = 1060
fire_galley = 1103
demolition_raft = 1104
siege_tower = 1105
ballista_elephant = 1120
elite_ballista_elephant = 1122
karambit_warrior = 1123
elite_karambit_warrior = 1125
arambai = 1126
elite_arambai = 1128
rattan_archer = 1129
elite_rattan_archer = 1131
battle_elephant = 1132
elite_battle_elephant = 1134
water_buffalo = 1142
ninja = 1145
imperial_skirmisher = 1155
sharkatzor = 1222
konnik = 1225
elite_konnik = 1227
keshik = 1228
elite_keshik = 1230
kipchak = 1231
elite_kipchak = 1233
leitis = 1234
elite_leitis = 1236
bactrian_camel = 1237
goose = 1243
pig = 1245
konnik_dismounted = 1252
elite_konnik_dismounted = 1253
battering_ram = 1258
flaming_camel = 1263
ox_cart = 1271
ox_wagon = 1273
khan = 1275
invisible_object = 1291
queen = 1292
alfred_the_alpaca = 1300
dragon_ship = 1302
relic_cart = 1304
cart = 1338
horse_b = 1356
steppe_lancer = 1370
elite_steppe_lancer = 1372
iroquois_warrior = 1374
torch_b_convertable = 1377
priest_with_relic = 1400
xolotl_warrior = 1570
merchant = 1572
photonman = 1577
cow_b = 1596
cow_c = 1598
cow_d = 1600
horse_c = 1602
horse_d = 1604
horse_e = 1606


def get_unit_id_by_string(tech):
    """
    Returns the ID of the given unit. None otherwise.
    """
    try:
        return eval(tech)
    except NameError:
        return None
