<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mcs_to_rate(mcs, bw=20, long_gi=True):
 """Convert MCS index to rate in Mbps. See http://mcsindex.com/ Args: mcs (int):
 MCS index long_gi(bool):
 True if long GI is used. Returns: rate (float):
 bitrate in Mbps 57.8 81 130 936 """

    if bw not in [20, 40, 80, 160]:
        raise Exception("Unknown bandwidth: %d MHz" % (bw))
    if mcs not in MCS_TABLE:
        raise Exception("Unknown MCS: %d" % (mcs))

    idx = int((math.log(bw/10, 2)-1)*2)
    if not long_gi:
        idx += 1
    return MCS_TABLE[mcs][idx]