import zipfile


def zip_to_gdal_path(filepath):
    """
    Takes in a zip filepath and if the zip contains files
    ascii files, prepend '/viszip' to the path 
    so that they can be opened using GDAL without extraction.
    
    """
    zip_file_list = []
    
    if zipfile.is_zipfile(filepath):
        try:
            zip_file = zipfile.ZipFile(filepath)
            zip_file_contents = ['/vsizip/{0}/{1}'.format(filepath, zip_info_object.filename) for zip_info_object in zip_file.filelist if           zip_info_object.filename.endswith('.asc')]
            zip_file_list.extend(zip_file_contents)
            zip_file.close()
        except zipfile.BadZipfile:
            pass

    return zip_file_list