def _get_type_to_speed(cfs):
    """Given a list of charging functions, returns an object whose keys
    are the CS types and values are speed rank.

    Speed rank is a CS type's (0-indexed) position in the ordered list of fastest CS types.
    """

    # compute max charge rates by type
    result = [{
        'cs_type': cf['@cs_type'],
        'max_rate': (
            (float(cf['breakpoint'][1]['battery_level'])-float(cf['breakpoint'][0]['battery_level'])) /
            (float(cf['breakpoint'][1]['charging_time']) -
             float(cf['breakpoint'][0]['charging_time']))
        )} for cf in cfs]

    # assign each type its speed rank (lowest = fastest --> highest = slowest)
    result = sorted(result, key=lambda x: x['max_rate'], reverse=True)
    for i, entry in enumerate(result):
        entry.update({'speed_rank': i})

    # return dict type:speed_rank
    return {cf['cs_type']: cf['speed_rank'] for cf in result}