The error is in the incorrect usage of Python's "rstrip" command. "rstrip" removes ANY occurrences of the characters in the search string you supply (in your case "_shp") from the right side of the processed string. This is why it is going wrong, since "citiespop_shp" contains an additional "p" character as the ending, and since "p", is part of "_shp", it is also removed from "citiespop", resulting in "citiespo". The removing only stops at the "o" character ("citiespo"), as that is the first character not part of the search string "_shp"
Please note that for "rstring", the order of the characters you supply is irrelevant. If you coded:
"teststring.rstring("phs_")"
the results would be exactly the same, e.g. giving you "citiespo" for the processed basename "citiespop_shp"
You will need to use another of Python's string commands to accomplish what you want to do.