def parse_bandwidth(bandwidth):
    """Converts the bandwidth string (e.g. 5M) to a float representing megabits.
    """
    if bandwidth[-1].lower() == 'm':
        return int(bandwidth[:-1])
    elif bandwidth[-1].lower() == 'k':
        return int(bandwidth[:-1]) / 1024