code: def _no_primary(max_staleness, selection):
      
      # Secondary that's replicated the most recent writes.
      smax = selection.secondary_with_max_last_write_date()
      if not smax:
          # No secondaries and no primary, short-circuit out of here.
          return selection.with_server_descriptions([])
  
      sds = []
  
      for s in selection.server_descriptions:
          if s.server_type == SERVER_TYPE.RSSecondary:
              # See max-staleness.rst for explanation of this formula.
              staleness = (smax.last_write_date -
                           s.last_write_date +
                           selection.heartbeat_frequency)
  
              if staleness <= max_staleness:
                  sds.append(s)
          else:
              sds.append(s)
  
      return selection.with_server_descriptions(sds)
docs: Apply max_staleness, in seconds, to a Selection with no known primary.