Python3 script to get volume serial from volume (must be root on Linux)

#!/usr/bin/env python3

import sys

volsn_offset = 0x48
volsn_length = 8

for s in sys.argv[1:]:
        with open(s,"rb") as f:
            a =
            b = a[volsn_offset:volsn_offset+volsn_length]
            c = "".join(reversed(list(map(lambda t: "{:02x}".format(t),b))))
    except PermissionError as e:
        print("Permission denied for {}: are you root?".format(s))
        print("  Error: {}".format(e))
    except FileNotFoundError as e:
        print("File {} not found.".format(s))
        print("  Error: {}".format(e))