def solve_feedme_template(template, search_replace):
    """
    Replaces all patterns in template text, returning a (hopefully) sane GALFIT FEEDME text

    Args:
        template: template text
        search_replace: [(search0, replace0), (search1, replace1), ...], i.e., search-replace pairs

    Returns:
        str: contents
    """
    contents = template
    for pattern, str_replace in search_replace:
        contents = contents.replace(pattern, str_replace)
    return contents
