def EITCamount(basic_frac, phasein_rate, earnings, max_amount,
               phaseout_start, agi, phaseout_rate):
    """
    Returns EITC amount given specified parameters.
    English parameter names are used in this function because the
    EITC formula is not available on IRS forms or in IRS instructions;
    the extensive IRS EITC look-up table does not reveal the formula.
    """
    eitc = min((basic_frac * max_amount +
                (1.0 - basic_frac) * phasein_rate * earnings), max_amount)
    if earnings > phaseout_start or agi > phaseout_start:
        eitcx = max(0., (max_amount - phaseout_rate *
                         max(0., max(earnings, agi) - phaseout_start)))
        eitc = min(eitc, eitcx)
    return eitc