<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calculate_rates(base_currency, counter_currency, forward_rate=None, fwd_points=None, spot_reference=None):
 """Calculate rates for Fx Forward based on others."""

    if base_currency not in DIVISOR_TABLE:
        divisor = DIVISOR_TABLE.get(counter_currency, DEFAULT_DIVISOR)
        if forward_rate is None and fwd_points is not None and spot_reference is not None:
            forward_rate = spot_reference + fwd_points / divisor
        elif forward_rate is not None and fwd_points is None and spot_reference is not None:
            fwd_points = (forward_rate - spot_reference) * divisor
        elif forward_rate is not None and fwd_points is not None and spot_reference is None:
            spot_reference = forward_rate - fwd_points / divisor

    rates = {}
    if forward_rate is not None:
        rates['forward_rate'] = forward_rate

    if fwd_points is not None:
        rates['fwd_points'] = fwd_points

    if spot_reference is not None:
        rates['spot_reference'] = spot_reference

    return rates