def get_matching_service_template_file(service_name, template_files):
    """
    Return the template file that goes with the given service name, or return
    None if there's no match.  Subservices return the parent service's file.
    """
    # If this is a subservice, use the parent service's template
    service_name = service_name.split('.')[0]
    if service_name in template_files:
        return template_files[service_name]
    return None