def AMED(e00200, MARS, AMED_thd, _sey, AMED_trt, FICA_mc_trt, FICA_ss_trt):
    """
    Additional Medicare Tax as a part of FICA
    
    
    Notes
    -----
    Tax Law Parameters:    
        AMED_thd : Additional medicare threshold
        
        AMED_trt : Additional medicare tax rate
        
        FICA_ss_trt : FICA social security tax rate
        
        FICA_mc_trt : FICA medicare tax rate
    
    Taxpayer Charateristics:     
        e00200 : Total wages and salaries
        
        _sey : Business and Farm net income/loss
    
    Returns
    -------
    _amed : Additional medicare tax amount
    
    
    """
    
    # ratio of income subject to AMED tax = (1 - 0.5 * (FICA_mc_trt+FICA_ss_trt)
    _amed = AMED_trt * max(0, e00200 
                + max(0, _sey) * (1 - 0.5 * (FICA_mc_trt+FICA_ss_trt))
                - AMED_thd[MARS-1]) 

    return _amed