code: def _StopFolderSelectionMethod(self, stop_folder):
      
      if not self.show_stop_hierarchy:
        return lambda stop: (stop_folder, None)
  
      # Create the various sub-folders for showing the stop hierarchy
      station_folder = self._CreateFolder(stop_folder, 'Stations')
      platform_folder = self._CreateFolder(stop_folder, 'Platforms')
      platform_connections = self._CreateFolder(platform_folder, 'Connections')
      entrance_folder = self._CreateFolder(stop_folder, 'Entrances')
      entrance_connections = self._CreateFolder(entrance_folder, 'Connections')
      standalone_folder = self._CreateFolder(stop_folder, 'Stand-Alone')
  
      def FolderSelectionMethod(stop):
        if stop.location_type == transitfeed.Stop.LOCATION_TYPE_STATION:
          return (station_folder, None)
        elif stop.location_type == googletransit.Stop.LOCATION_TYPE_ENTRANCE:
          return (entrance_folder, entrance_connections)
        elif stop.parent_station:
          return (platform_folder, platform_connections)
        return (standalone_folder, None)
  
      return FolderSelectionMethod
docs: Create a method to determine which KML folder a stop should go in.
  
      Args:
        stop_folder: the parent folder element for all stops.
  
      Returns:
        A function that should accept a Stop argument and return a tuple of
        (stop KML folder, pathways KML folder).
  
      Given a Stop, we need to determine which folder the stop should go in.  In
      the most basic case, that's the root Stops folder.  However, if
      show_stop_hierarchy is enabled, we put a stop in a separate sub-folder
      depending on if the stop is a station, a platform, an entrance, or just a
      plain-old stand-alone stop.  This method returns a function that is used
      to pick which folder a stop stop should go in.  It also optionally returns
      a folder where any line-string connections associated with a stop (eg. to
      show the pathway between an entrance and a station) should be added.