Currently a barebones implementation, this script will copy iMessage files from an iPhone backup and place them within a folder named _export on the desktop.
python backup.py "$backup_hash"
where $backup_hash is the name of the folder you want to back up found in $HOME/Library/Application Support/MobileSync/Backup