def set_name_from_dict(string, dictionary, key, leading, trailing):
    """Replaces the string with the value from a specified dictionary key,
    prepending and appending the leading/trailing text as applicable"""
    return "{}{}{}".format(leading,
                           dictionary[key],
                           trailing)