Well, do you have a script that can convert
one uncompressed key to a compressed key?
If that is so, start with that. Then you can write a simple function around it that takes a list of keys like this:
#!/bin/python
def to_compressed(key):
# .... return the compressed key
def many_to_compressed(keys):
for key in keys:
print(to_compressed(key))