def _get_service_file(squadron_dir, service_name, service_ver, filename, on_error=None, config=None):
    """
    Grabs the named service file in a service directory

    Keyword arguments:
        squadron_dir -- base directory
        service_name -- the name of the service
        service_ver -- the version of the service
        filename -- the name of the service file without the extension
        empty_on_error -- if true, returns an empty dict instead of raising error
        config -- if a dict, uses it to template the file before loading it
    """
    ex = None
    for ext in extensions:
        try:
            serv_dir = os.path.join(squadron_dir, 'services', service_name, service_ver)
            service_file = os.path.join(serv_dir, filename + ext)
            if config:
                loader = FileLoader(squadron_dir)
                template = loader.load_template(service_file)
                return yaml.load(template.render(config, loader=loader))
            else:
                with open(service_file, 'r') as sfile:
                    return yaml.load(sfile.read())
        except (__HOLE__, IOError) as e:
            if e.errno == errno.ENOENT:
                ex = e
            else:
                raise e

    if on_error is not None:
        return on_error
    raise ex
dataset/ETHPy150Open gosquadron/squadron/squadron/commit.py/_get_service_file