can't this loop just be done as 
```python
for degen_char in degen_map:
     degen_map[degen_char.lower()] = degen_map[degen_char].lower()
```

applies to line 1031 as well.