Refactor recording api methods and fix logic

Refactored code of recording api setup, teardown, and
endpoint functions.

Added a get_current_state_str() method to Multimedia to make some code
in recording api cleaner.

Fix to recording api logic determining next_id.
Fix to test_server.py teardown to undo patching to media_dict
Not sure why flake8 isn't complaining about this. There should be a space after the `#` in a comment before the actual message.

I'm also not sure if it's even necessary as the logic is straightforward.