Convert all lines from byte string to unicode string, if necessary

def _bytes_to_str(lines):
    """
    Convert all lines from byte string to unicode string, if necessary
    """
    if len(lines) >= 1 and hasattr(lines[0], 'decode'):
        return [line.decode('utf-8') for line in lines]
    else:
        return lines