def extract_output(out):
    """
    Extracts output for one filing unit in out and
    returns extracted output as a dictionary.

    Parameters
    ----------
    out: pandas DataFrame row containing tc --dump output for one filing unit

    Returns
    -------
    ovar: dictionary of output variables indexed from 1 to 28

    Notes
    -----
    The value of each output variable is stored in the ovar dictionary,
    which is indexed as Internet-TAXSIM output variables are (where the
    index begins with one).
    """
    ovar = {}
    ovar[1] = int(out['RECID'])  # id for tax filing unit
    ovar[2] = int(out['FLPDYR'])  # year taxes are calculated
    ovar[3] = 0  # state code is always zero
    ovar[4] = out['iitax']  # federal income tax liability
    ovar[5] = 0.0  # no state income tax calculation
    ovar[6] = out['payrolltax']  # ee+er for OASDI+HI
    ovar[7] = out['mtr_inctax']  # marginal federal income tax rate as percent
    ovar[8] = 0.0  # no state income tax calculation
    ovar[9] = out['mtr_paytax']  # marginal payroll tax rate as percent
    ovar[10] = out['c00100']  # federal AGI
    ovar[11] = out['e02300']  # UI benefits in AGI
    ovar[12] = out['c02500']  # OASDI benefits in AGI
    ovar[13] = 0.0  # always set zero-bracket amount to zero
    pre_phase_out_pe = out['pre_c04600']
    post_phase_out_pe = out['c04600']
    phased_out_pe = pre_phase_out_pe - post_phase_out_pe
    ovar[14] = post_phase_out_pe  # post-phase-out personal exemption
    ovar[15] = phased_out_pe  # personal exemption that is phased out
    # ovar[16] can be positive for non-itemizer:
    ovar[16] = out['c21040']  # phased out itemized deduction
    # ovar[17] is zero for non-itemizer:
    ovar[17] = out['c04470']  # post-phase-out item deduction
    ovar[18] = out['c04800']  # federal regular taxable income
    # ovar[19] is regular tax on taxable income
    ovar[19] = out['taxbc']
    ovar[20] = 0.0  # always set exemption surtax to zero
    ovar[21] = 0.0  # always set general tax credit to zero
    ovar[22] = out['c07220'] + out['odc']  # non-refundable child+odep credit
    ovar[23] = out['c11070']  # refundable additional child tax credit
    ovar[24] = out['c07180']  # child care credit
    ovar[25] = out['eitc']  # federal EITC
    ovar[26] = out['c62100']  # federal AMT taxable income
    amt_liability = out['c09600']  # federal AMT liability
    ovar[27] = amt_liability
    # ovar[28] is federal income tax before credits; the Tax-Calculator
    # out['c05800'] is this concept but includes AMT liability
    # while Internet-TAXSIM ovar[28] explicitly excludes AMT liability, so
    # we have the following:
    ovar[28] = out['c05800'] - amt_liability
    return ovar