def ValidateNearbyStops(self, problems):
    # Check for stops that might represent the same location (specifically,
    # stops that are less that 2 meters apart) First filter out stops without a
    # valid lat and lon. Then sort by latitude, then find the distance between
    # each pair of stations within 2 meters latitude of each other. This avoids
    # doing n^2 comparisons in the average case and doesn't need a spatial
    # index.
    sorted_stops = filter(lambda s: s.stop_lat and s.stop_lon,
                          self.GetStopList())
    sorted_stops.sort(
        key=(lambda x: [x.stop_lat, x.stop_lon, getattr(x, 'stop_id', None)]))
    TWO_METERS_LAT = 0.000018
    for index, stop in enumerate(sorted_stops[:-1]):
      index += 1
      while ((index < len(sorted_stops)) and
             ((sorted_stops[index].stop_lat - stop.stop_lat) < TWO_METERS_LAT)):
        distance  = util.ApproximateDistanceBetweenStops(stop,
                                                         sorted_stops[index])
        if distance is not None and distance < 2:
          other_stop = sorted_stops[index]
          if stop.location_type == 0 and other_stop.location_type == 0:
            problems.StopsTooClose(
                util.EncodeUnicode(stop.stop_name),
                util.EncodeUnicode(stop.stop_id),
                util.EncodeUnicode(other_stop.stop_name),
                util.EncodeUnicode(other_stop.stop_id), distance)
          elif stop.location_type == 1 and other_stop.location_type == 1:
            problems.StationsTooClose(
                util.EncodeUnicode(stop.stop_name),
                util.EncodeUnicode(stop.stop_id),
                util.EncodeUnicode(other_stop.stop_name),
                util.EncodeUnicode(other_stop.stop_id), distance)
          elif (stop.location_type in (0, 1) and
                other_stop.location_type  in (0, 1)):
            if stop.location_type == 0 and other_stop.location_type == 1:
              this_stop = stop
              this_station = other_stop
            elif stop.location_type == 1 and other_stop.location_type == 0:
              this_stop = other_stop
              this_station = stop
            if this_stop.parent_station != this_station.stop_id:
              problems.DifferentStationTooClose(
                  util.EncodeUnicode(this_stop.stop_name),
                  util.EncodeUnicode(this_stop.stop_id),
                  util.EncodeUnicode(this_station.stop_name),
                  util.EncodeUnicode(this_station.stop_id), distance)
        index += 1
dataset/ETHPy150Open google/transitfeed/transitfeed/schedule.py/Schedule.ValidateNearbyStops/original