from future.standard_library import hooks
with hooks():
    from urllib.parse import urlparse

import caniusepython3 as ciu


def main():
    import sys
    project = sys.argv[1]

    # check if there is github page
    with ciu.pypi.pypi_client() as client:
        releases = client.package_releases(project)
        if not releases:
            print('NO releases found for {}'.format(project))
            sys.exit(1)

        got_github = False
        version = releases[0]
        package_data = client.package_data(project, version)

        classifiers = package_data['classifiers']
        for classifier in classifiers:
            if 'Programming Language :: Python :: 3' in classifier:
                print('py3 OK')
                sys.exit(0)

        r = urlparse(package_data['home_page'])
        if r.netloc == 'github.com':
            got_github = True
        if got_github:
            print('github FOUND')
        else:
            print('github NOT FOUND')

    print('py3 NOT OK')
    sys.exit(1)

if __name__ == '__main__':
    main()

@@ -177,44 +177,8 @@
 1%5D%0A%0A
-    # check if there is github page%0A
     
@@ -216,16 +216,55 @@
 client:%0A
+        # get package data for project%0A
         
@@ -421,36 +421,8 @@
 t(1)
-%0A%0A        got_github = False
 %0A   
@@ -510,16 +510,96 @@
 rsion)%0A%0A
+        # check if project supports py3%0A        # if yes, do nothing more, exit%0A
         
@@ -807,16 +807,111 @@
 exit(0)%0A
+        print('py3 NOT OK')%0A%0A        # check if there is github page%0A        got_github = False
 %0A       
@@ -1132,32 +1132,8 @@
 ')%0A%0A
-    print('py3 NOT OK')%0A
     

Add some comments