def get_substituted_contents(contents, substitutions):
    """
    Perform a list of substitutions and return the result.

    contents: the starting string on which to beging substitutions
    substitutions: list of Substitution objects to call, in order, with the
        result of the previous substitution.
    """
    result = contents
    for sub in substitutions:
        result = sub.apply_and_get_result(result)
    return result