import ast


def is_py3(file_path):
    """Check if code is Python3 compatible."""
    # https://stackoverflow.com/a/40886697
    code_data = open(file_path, "rb").read()
    try:
        ast.parse(code_data)
    except SyntaxError:
        return False
    return True