Error On creating Custom button

Hi there, @Sangram
I have created a custom button in employee.
What I am trying to implement is that when i click on the button, leave
must be allocated for the particular employee till the end of the fiscal
year from its confirmation date.
Unable to execute syntaxes, Not able to traceback the error.
pasting the code as well for the reference:
The problem i am facing is that the system is unable to fetch data from the fiscal year and it stops the execution after printing med.
It does not enter in the if block as well.
JS Script:
cur_frm.add_custom_button(__(“Allocate Leave”),function(){{
leave_type:“Privilege Leave”,
PY Script:

def allocate_leave(employee,conf_date,leave_type,joining_date):
    print "Employee="+str(employee)
    print "Leave type= "+str(leave_type)
    print "joining_date = "+str(joining_date)
    carry_forwarded_leaves = 0
    cd = getdate(conf_date)
    print "Conf_Date: "+str(cd)
    fed = frappe.get_value("Fiscal Year", "Fiscal Year", "year_end_date")
    print "Fiscal End Date = "+str(fed)
    tm = relativedelta(fed,cd).months
    print ("Total months = "+ str(tm))
    med = cd + relativedelta(day =20)
    print "med= "+str(med)

    if med < cd:
        med +=relativedelta(months=1)
        print "MED= "+str(med)

    if (med-cd).days < 15:
        med= med + relativedelta(months =1)
        print "MED= "+str(med)
    #for i in range(tm):

        #l_a_doc = frappe.new_doc("Leave Allocation")
        #l_a_doc.update({'employee':employee,'from_date':med - relativedelta(months=1,day = 21),'to_date':med+relativedelta(months=i),'leave_type':'Privilege Leave','carry_forward':1,'new_leaves_allocated':1.75}) = True)

The output i have received in terminal is as follows:
19:44:38 web.1 |Employee=EMP/0002
19:44:38 web.1 | Leave type= Privilege Leave
19:44:38 web.1 | joining_date = 2016-04-01
19:44:38 web.1 | Conf_Date: 2016-10-01
19:44:38 web.1 | Fiscal End Date = None
19:44:38 web.1 | Total months = 0
19:44:38 web.1 | med= 2016-10-20

frappe.get_value(“Fiscal Year”, fiscal_year, “year_end_date”)

Yeah already done.
Thanks Anyways.