code: def _compose_range(pattern, rule, fill=2):
      
      keys = []
      mask = len(pattern)
      for rule in str.split(rule, ","):
          if not '-' in rule:
              if rule[:mask] == pattern:
                  keys.append(rule[mask:])
              else:
                  keys.append(rule)
          else:
              (start, end) = str.split(rule, '-')
              if rule[:mask] == pattern:
                  start = int(start[mask:])
              else:
                  start = int(start)
              # Since I allow both "Week00-15" and "Week00-Week15", I need
              # to check for the second week.
              if end[0:mask] == pattern:
                  end = int(end[mask:])
              else:
                  end = int(end)
  
              key = "%%0%ii" % fill
              for i in range(start, end + 1):
                  keys.append(key % i)
  
      #print keys
      return keys
docs: oc._compose_range('Week', 'Week04-Week09', fill=2) - hash a range.
  
      This takes apart a range of times and returns a dictionary of
      all intervening values appropriately set.  The fill value is
      used to format the time numbers.