<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def QA_fetch_get_sh_margin(date):
 """return shanghai margin data Arguments: date {str YYYY-MM-DD} -- date format Returns: pandas.DataFrame -- res for margin data """

    if date in trade_date_sse:
        data= pd.read_excel(_sh_url.format(QA_util_date_str2int
                                            (date)), 1).assign(date=date).assign(sse='sh')             
        data.columns=['code','name','leveraged_balance','leveraged_buyout','leveraged_payoff','margin_left','margin_sell','margin_repay','date','sse']
        return data
    else:
        pass