[python] If list index exists, do X