def format_dictionary_keys(dictionary, formatter):
    """
    Returns a new dictionaries whose keys have been passed through
    `formatter`, which should be a function that formats strings.
    """
    new = {}
    for key, value in dictionary.items():
        assert isinstance(key, str)
        new[formatter(key)] = value
    return new