def show_prefixes():
    def filename_has_date(filename):
        try:
            import_date = find_date(filename)
            return True
        except (__HOLE__, ImportError), err:
            return False

    re_agency = re.compile('^[0-9]*[A-Z]+')
    def extract_prefix(filename):
        prefix_match = re_agency.match(filename.upper())
        if not prefix_match is None:
            prefix = prefix_match.group()
            return fix_prefix(prefix)
        else:
            return None

    files_to_process = filter(filename_has_date, map(os.path.basename, flattened(recursive_listdir(DOWNLOAD_DIR))))
    prefixes = map(extract_prefix, files_to_process)

    def unique(iterable):
        def combine(accum, item):
            accum[item] = None
            return accum
        return reduce(combine, iterable, {}).keys()

    def frequency(iterable):
        def combine(frequencies, item):
            cnt = frequencies.get(item, 0)
            frequencies[item] = cnt + 1
            return frequencies
        return reduce(combine, iterable, {})

    def print_freq(freq, indent=""):
        def value((k, v)):
            return v
        for s, f in sorted(freq.iteritems()):
            print "{0}{1!s:15}: {2!s:>7}".format(indent, s, f)

    print_freq(frequency(prefixes))
dataset/ETHPy150Open sunlightlabs/clearspending/timeliness/parser.py/show_prefixes