Correct Python 3 errors and lint warnings in build_release.py
Correct Python 3 errors and lint warnings in build_release.py

### Description

I think this file is still used, and it's about time we updated it for
compatibility with python3. While I was in there, I fixed all of the
linter warnings, so that it's easier to spot bad code.

### Pull request type

    [x] Fix
    [ ] Refactor
    [ ] Target update
    [ ] Functionality change
    [ ] Docs update
    [ ] Test update
    [ ] Breaking change

mbedmicro/mbed,andcor02/mbed-os,kjbracey-arm/mbed,andcor02/mbed-os,mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,mbedmicro/mbed,mbedmicro/mbed,kjbracey-arm/mbed,andcor02/mbed-os,andcor02/mbed-os,andcor02/mbed-os,kjbracey-arm/mbed