pretty-journal: convert to python3 and format

It was reported by a user that they still use this.  Convert it to
python3, fix the flake8 issues, and format with black.  Tested by
running on a few `journalctl -o json-pretty` entries from my own
system.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2689b0e21fb1aae9564c531e0eda69e8eeead571
diff --git a/pretty-journal/pretty-journal.py b/pretty-journal/pretty-journal.py
old mode 100644
new mode 100755
index 4014f8d..7cf4415
--- a/pretty-journal/pretty-journal.py
+++ b/pretty-journal/pretty-journal.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 BMC FFDC will at times include the journal in json format
@@ -15,29 +15,31 @@
 def jpretty_to_python(buf):
     entries = []
 
-    for entry in re.findall(
-            '^{$(.+?)^}$', buf, re.DOTALL | re.MULTILINE):
-        entries += [json.loads('{{{}}}'.format(entry))]
+    for entry in re.findall("^{$(.+?)^}$", buf, re.DOTALL | re.MULTILINE):
+        entries += [json.loads("{{{}}}".format(entry))]
 
     return entries
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     parser = ArgumentParser()
     parser.add_argument(
-        'journalfile', metavar='FILE', help='the file to parse')
+        "journalfile", metavar="FILE", help="the file to parse"
+    )
 
     args = parser.parse_args()
 
     with open(args.journalfile) as fd:
         entries = jpretty_to_python(fd.read())
-        entries = sorted(entries, key=lambda k: k['__REALTIME_TIMESTAMP'])
+        entries = sorted(entries, key=lambda k: k["__REALTIME_TIMESTAMP"])
 
         for e in entries:
-            e['ts'] = time.ctime(
-                float(e['__REALTIME_TIMESTAMP']) / 1000000).rstrip()
+            e["ts"] = time.ctime(float(e["__REALTIME_TIMESTAMP"]) / 1000000)
             try:
-                print ('{ts} {_HOSTNAME} {SYSLOG_IDENTIFIER}: {MESSAGE}'.format(**e))
-            except:
-                print ("Unable to parse msg: " + str(e))
+                print(
+                    f'{e["ts"]} {e["_HOSTNAME"]} {e["SYSLOG_IDENTIFIER"]}:'
+                    f' {e["MESSAGE"]}'
+                )
+            except Exception:
+                print("Unable to parse msg: " + str(e))
                 continue