def locateCity(location, correctMisspelling=False, debug=False): ''' locate the given location string Args: location(string): the description of the location Returns: Locator: the location ''' e = Extractor(text=location, debug=debug) e.split() loc = Locator.getInstance(correctMisspelling=correctMisspelling, debug=debug) city = loc.locateCity(e.places) return city