You seem to have a lot of string concatenation with a[data-location="data_location/PATH].  It's probably worth making a helper function to generate these strings so the steps are more succinct:

    def data_link_sel(path):
        return 'a[data-location="{}/{}"]'.format(DATA_LOCATION, path)