def main():
    if len(sys.argv) < 2:
        print('usage: python prepgml4ogr.py file [[prep_module.]prep_class]')
        sys.exit(1)

    inputfile = sys.argv[1]
    if os.path.exists(inputfile):

        # Create an instance of a preparer
        # class which is used to prepare
        # features as they are read
        prep_class = 'prep_gml'
        try:
            prep_class = sys.argv[2]
        except __HOLE__:
            pass
        prep_class = get_preparer(prep_class)
        preparer = prep_class(inputfile)

        parser = make_parser()
        parser.setContentHandler(gmlhandler(preparer))

        if os.path.splitext(inputfile)[1].lower() == '.zip':
            archive = zipfile.ZipFile(inputfile, 'r')
            for filename in archive.namelist():
                file = archive.open(filename)
                try:
                    parser.parse(file)
                except:
                    # Ignore any files that can't be parsed
                    pass
        else:
            if os.path.splitext(inputfile)[1].lower() == '.gz':
                file = gzip.open(inputfile, 'r')
            else:
                # Assume non compressed gml, xml or no extension
                file = open(inputfile, 'r')
            parser.parse(file)

    else:
        print('Could not find input file: ' + inputfile)
dataset/ETHPy150Open AstunTechnology/Loader/python/prepgml4ogr.py/main