code: def locale_first_weekday():
      
      first_weekday = 6 #by default settle on monday
  
      try:
          process = os.popen("locale first_weekday week-1stday")
          week_offset, week_start = process.read().split('\n')[:2]
          process.close()
          week_start = dt.date(*time.strptime(week_start, "%Y%m%d")[:3])
          week_offset = dt.timedelta(int(week_offset) - 1)
          beginning = week_start + week_offset
          first_weekday = int(beginning.strftime("%w"))
      except:
          logger.warn("WARNING - Failed to get first weekday from locale")
  
      return first_weekday
docs: figure if week starts on monday or sunday