Format a URL for loading data from Bank of Canada.

def _format_url(instrument_type,
                instrument_ids,
                start_date,
                end_date,
                earliest_allowed_date):
    """
    Format a URL for loading data from Bank of Canada.
    """
    return (
        "http://www.bankofcanada.ca/stats/results/csv"
        "?lP=lookup_{instrument_type}_yields.php"
        "&sR={restrict}"
        "&se={instrument_ids}"
        "&dF={start}"
        "&dT={end}".format(
            instrument_type=instrument_type,
            instrument_ids='-'.join(map(prepend("L_"), instrument_ids)),
            restrict=earliest_allowed_date.strftime("%Y-%m-%d"),
            start=start_date.strftime("%Y-%m-%d"),
            end=end_date.strftime("%Y-%m-%d"),
        )
    )