You can use the re module for python regex. Here are
the documents.
You’ll also need to open a zip file (epub is just a zip with .epub extension) - you can try the
zipfile module, but there may be others - and then you can read the metadata file (.opf) and then use the
os module to rename the epub file.