
__CODES = \
    [("IS","Revenue","ITEM_SALE"),
    ("IS","Other Revenue, Total","ITEM_OSALE"),
    ("IS","Total Revenue","SALE"),
    ("IS","Cost of Revenue, Total","COGS"),
    ("IS","Gross Profit","ITEM_GROSS_PROFIT"),
    ("IS","Selling/General/Admin. Expenses, Total","XSGA"),
    ("IS","Research & Development","ITEM_RND"),
    ("IS","Depreciation/Amortization","DP"),
    ("IS","Interest Expense(Income) - Net Operating","ITEM_XINT_OPT"),
    ("IS","Unusual Expense (Income)","ITEM_UNUSUAL_EXP"),
    ("IS","Other Operating Expenses, Total","ITEM_OEXP"),
    ("IS","Total Operating Expense","ITEM_TEXP"),
    ("IS","Operating Income","ITEM_OPTINC"),
    ("IS","Interest Income(Expense), Net Non-Operating","ITEM_XINT_NONOPT"),
    ("IS","Gain (Loss) on Sale of Assets","ITEM_ASSETS_SALE_PROFIT"),
    ("IS","Other, Net","ITEM_OTHER_NET"),
    ("IS","Income Before Tax","PI"),
    ("IS","Income After Tax","ITEM_P_AFTER_TAX"),
    ("IS","Minority Interest","MII"),
    ("IS","Equity In Affiliates","ITEM_AFFILIATES"),
    ("IS","Net Income Before Extra. Items","IB"),
    ("IS","Accounting Change","ITEM_ACCOUNTING_CHANGE"),
    ("IS","Discontinued Operations","DO"),
    ("IS","Extraordinary Item","XI"),
    ("IS","Net Income","NI"),
    ("IS","Preferred Dividends","ITEM_PREF_DVD"),
    ("IS","Income Available to Common Excl. Extra Items","ITEM_INCOME_EX_EXTRA"),
    ("IS","Income Available to Common Incl. Extra Items","IBCOM"),
    ("IS","Basic Weighted Average Shares","CSHPRI"),
    ("IS","Basic EPS Excluding Extraordinary Items","EPSPX"),
    ("IS","Basic EPS Including Extraordinary Items","EPSPI"),
    ("IS","Dilution Adjustment","ITEM_DILUTION_ADJ"),
    ("IS","Diluted Weighted Average Shares","CSHFD"),
    ("IS","Diluted EPS Excluding Extraordinary Items","EPSFX"),
    ("IS","Diluted EPS Including Extraordinary Items","EPSFI"),
    ("IS","Dividends per Share - Common Stock Primary Issue","ITEM_DPS"),
    ("IS","Gross Dividends - Common Stock","ITEM_GROSS_DVD"),
    ("IS","Net Income after Stock Based Comp. Expense","ITEM_NI_EX_STOCK_COMP"),
    ("IS","Basic EPS after Stock Based Comp. Expense","ITEM_BEPS_EX_STOCK_COMP"),
    ("IS","Diluted EPS after Stock Based Comp. Expense","ITEM_DEPS_EX_STOCK_COMP"),
    ("IS","Depreciation, Supplemental","ITEM_DP_SUPP"),
    ("IS","Total Special Items","SPI"),
    ("IS","Normalized Income Before Taxes","ITEM_NORM_PI"),
    ("IS","Effect of Special Items on Income Taxes","ITEM_SPI_INC_TAX"),
    ("IS","Income Taxes Ex. Impact of Special Items","ITEM_INC_TAX_EX_SPI"),
    ("IS","Normalized Income After Taxes","ITEM_NORM_INC_EX_TAX"),
    ("IS","Normalized Income Avail to Common","ITEM_NORM_INC"),
    ("IS","Basic Normalized EPS","ITEM_BEPS"),
    ("IS","Diluted Normalized EPS","ITEM_D_NORM_EPS"),
    ("BS","Cash & Equivalents","CHE"),
    ("BS","Short Term Investments","IVST"),
    ("BS","Cash and Short Term Investments","ITEM_CH_IVST"),
    ("BS","Accounts Receivable - Trade, Net","RECTR"),
    ("BS","Receivables - Other","RECCO"),
    ("BS","Total Receivables, Net","RECT"),
    ("BS","Total Inventory","INVT"),
    ("BS","Prepaid Expenses","XPP"),
    ("BS","Other Current Assets, Total","ACO"),
    ("BS","Total Current Assets","ACT"),
    ("BS","Property/Plant/Equipment, Total - Gross","PPENT"),
    ("BS","Accumulated Depreciation, Total","DPACT"),
    ("BS","Goodwill, Net","ITEM_GOODWILL"),
    ("BS","Intangibles, Net","INTAN"),
    ("BS","Long Term Investments","ITEM_LT_INV"),
    ("BS","Other Long Term Assets, Total","ITEM_OLT_INV"),
    ("BS","Total Assets","AT"),
    ("BS","Accounts Payable","AP"),
    ("BS","Accrued Expenses","XACC"),
    ("BS","Notes Payable/Short Term Debt","NP"),
    ("BS","Current Port. of LT Debt/Capital Leases","ITEM_CURR_PORT_LT_DEBT_CAPITAL_LEASE"),
    ("BS","Other Current liabilities, Total","LCO"),
    ("BS","Total Current Liabilities","LCT"),
    ("BS","Long Term Debt","ITEM_LT_DEBT"),
    ("BS","Capital Lease Obligations","ITEM_CAPITAL_LEASE"),
    ("BS","Total Long Term Debt","DLTT"),
    ("BS","Total Debt","DT"),
    ("BS","Deferred Income Tax","TXDITC"),
    ("BS","Minority Interest","MIB"),
    ("BS","Other Liabilities, Total","LO"),
    ("BS","Total Liabilities","LT"),
    ("BS","Redeemable Preferred Stock, Total","PSTKR"),
    ("BS","Preferred Stock - Non Redeemable, Net","PSTKN"),
    ("BS","Common Stock, Total","CEQ"),
    ("BS","Additional Paid-In Capital","ITEM_PAIDIN_CAP"),
    ("BS","Retained Earnings (Accumulated Deficit)","RE"),
    ("BS","Treasury Stock - Common","TSTK"),
    ("BS","Other Equity, Total","ITEM_OEQUITY"),
    ("BS","Total Equity","SEQ"),
    ("BS","Total Liabilities & Shareholders' Equity","ITEM_TL_SEQ"),
    ("BS","Shares Outs - Common Stock Primary Issue","ITEM_SHARESOUT_PRIMARY"),
    ("BS","Total Common Shares Outstanding","ITEM_SHARESOUT"),
    ("CS","Net Income/Starting Line","IBC"),
    ("CS","Depreciation/Depletion","DPC"),
    ("CS","Amortization","ITEM_AM"),
    ("CS","Deferred Taxes","TXDC"),
    ("CS","Non-Cash Items","ITEM_NON_CASH"),
    ("CS","Changes in Working Capital","ITEM_CHG_IN_WC"),
    ("CS","Cash from Operating Activities","OANCF"),
    ("CS","Capital Expenditures","CAPX"),
    ("CS","Other Investing Cash Flow Items, Total","ITEM_OINV_CF"),
    ("CS","Cash from Investing Activities","IVNCF"),
    ("CS","Financing Cash Flow Items","ITEM_FIN_CFI"),
    ("CS","Total Cash Dividends Paid","DV"),
    ("CS","Issuance (Retirement) of Stock, Net","ITEM_STOCK_ISSUE"),
    ("CS","Issuance (Retirement) of Debt, Net","ITEM_DEBT_ISSUE"),
    ("CS","Cash from Financing Activities","FINCF"),
    ("CS","Foreign Exchange Effects","ITEM_FOR_EXCHG"),
    ("CS","Net Change in Cash","CHECH"),
    ("CS","Cash Interest Paid, Supplemental","ITEM_CASH_INT_PAID"),
    ("CS","Cash Taxes Paid, Supplemental","ITEM_CASH_TAX_PAID")]


name_dict        = {k : (f, c) for f, k, c in __CODES}
name_dict_keys   = [k for f, k, c in __CODES]

name_I_dict      = {k : (f, c) for f, k, c in __CODES if f == "I"}
name_I_dict_keys = [k for f, k, c in __CODES if f == "I"]

name_B_dict      = {k : (f, c) for f, k, c in __CODES if f == "B"}
name_B_dict_keys = [k for f, k, c in __CODES if f == "B"]

name_C_dict      = {k : (f, c) for f, k, c in __CODES if f == "C"}
name_C_dict_keys = [k for f, k, c in __CODES if f == "C"]
