code: def bucketCSVs(csvFile, bucketIdx=2):
    
    try:
      with open(csvFile, "rU") as f:
        reader = csv.reader(f)
        headers = next(reader, None)
        dataDict = OrderedDict()
        for lineNumber, line in enumerate(reader):
          if line[bucketIdx] in dataDict:
            dataDict[line[bucketIdx]].append(line)
          else:
            # new bucket
            dataDict[line[bucketIdx]] = [line]
    except IOError as e:
      print e
  
    filePaths = []
    for i, (_, lines) in enumerate(dataDict.iteritems()):
      bucketFile = csvFile.replace(".", "_"+str(i)+".")
      writeCSV(lines, headers, bucketFile)
      filePaths.append(bucketFile)
  
    return filePaths
docs: Write the individual buckets in csvFile to their own CSV files.