def deduplicate_cities(city, dup_city):
 users = dup_city.userprofile_set.all()
 if users.exists():
  users.update(geo_city=city, geo_region=city.region, geo_country=city.country)
 dup_city.delete()

def deduplicate_cities ( city , dup_city ) : users = dup_city . userprofile_set . all ( ) if users . exists ( ) : users . update ( geo_city = city , geo_region = city . region , geo_country = city . country ) dup_city . delete ( )
given 2 city instances .