[FIX] Make the user-agent Python 3 compatible

Python 3 break two things about user-agent:
  - 'encode' returns bytes and not a string, because the encoded
    result isn't used and it's only important that it could be
    encoded the result is discarded
  - The version of the git directory can't be determined, because
    the stdout (and stderr/stdin) are bytes (list of bytes) and
    not strings. Those need to be converted.

Change-Id: I191ab067eb2d8afe4e8f8d73f90408846add713a