So recently I have been trying to unrar files in python with limited success.
After spending what felt like hours trying to track down the problem it was quite a simple fix.
So if you get this error:
rarfile.RarUnknownError: Unknown exit code : bsdtar: Unrecognized archive format
Then you just need to install the unrar executable like so:
brew install unrar
apt-get install unrar