def check_flags(verbosity=1):
    files = {}
    this_dir = os.path.dirname(__file__)
    for path in glob.glob(os.path.join(this_dir, 'static', 'flags', '*.gif')):
        files[os.path.basename(os.path.splitext(path)[0]).upper()] = path
    flags_missing = (set(COUNTRIES) - set(files))
    if flags_missing:
        print('The following country codes are missing a flag:')
        for code in sorted(flags_missing):
            print('  {0} ({1})'.format(code, COUNTRIES[code]))
    elif verbosity:
        print('All country codes have flags. :)')
    code_missing = (set(files) - set(COUNTRIES))
    for special_code in ('EU', '__'):
        code_missing.discard(special_code)
    if code_missing:
        print('')
        print("The following flags don't have a matching country code:")
        for path in sorted(code_missing):
            print('  {0}'.format(path))
def check_flags(verbosity=1):
    files = {}
    this_dir = os.path.dirname(__file__)
    for path in glob.glob(os.path.join(this_dir, 'static', 'flags', '*.gif')):
        files[os.path.basename(os.path.splitext(path)[0]).upper()] = path
    flags_missing = (set(COUNTRIES) - set(files))
    if flags_missing:
        print('The following country codes are missing a flag:')
        for code in sorted(flags_missing):
            print('  {0} ({1})'.format(code, COUNTRIES[code]))
    elif verbosity:
        print('All country codes have flags. :)')
    code_missing = (set(files) - set(COUNTRIES))
    for special_code in ('EU', '__'):
        code_missing.discard(special_code)
    if code_missing:
        print()
        print("The following flags don't have a matching country code:")
        for path in sorted(code_missing):
            print('  {0}'.format(path))