def bytes2str(s):
    """ Handle suprocess routines often return bytes instead of str in python3,
    which is different from python2 """
    if hasattr(s, 'decode'):
        return s.decode()
    else:
        return s
