def list_of_values(dictionary, list_of_keys, default=None):
    """
    Converts a dict to a list of its values,
    with the default value inserted for each missing key::

        >>> list_of_values({"a":1, "b":2, "d":4}, ["d","c","b","a"])
        [4, None, 2, 1]

        >>> list_of_values({"a":1, "b":2, "d":4}, ["d","c","b","a"], default=0)
        [4, 0, 2, 1]

    """
    result = []

    for key in list_of_keys:
        result.append(dictionary.get(key, default))

    return result