docs: def build_calendar_etc(pfeed):
      """
      Given a ProtoFeed, return a DataFrame representing ``calendar.txt``
      and a dictionary of the form <service window ID> -> <service ID>,
      respectively.
      """
      windows = pfeed.service_windows.copy()
  
      # Create a service ID for each distinct days_active field and map the
      # service windows to those service IDs
      def get_sid(bitlist):
          return 'srv' + ''.join([str(b) for b in bitlist])
  
      weekdays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday',
        'saturday', 'sunday']
      bitlists = set()
  
      # Create a dictionary <service window ID> -> <service ID>
      d = dict()
      for index, window in windows.iterrows():
          bitlist = window[weekdays].tolist()
          d[window['service_window_id']] = get_sid(bitlist)
          bitlists.add(tuple(bitlist))
      service_by_window = d
  
      # Create calendar
      start_date = pfeed.meta['start_date'].iat[0]
      end_date = pfeed.meta['end_date'].iat[0]
      F = []
      for bitlist in bitlists:
          F.append([get_sid(bitlist)] + list(bitlist) +
            [start_date, end_date])
      calendar = pd.DataFrame(F, columns=(
        ['service_id'] + weekdays + ['start_date', 'end_date']))
  
      return calendar, service_by_window