def METHOD_NAME(self, service_name=None, check_ec=False, **kw):
    """
    Applies the configuration to hosts.
    Args:
        service_name : name of the service
        check_ec (bool): check error message
        kw (dict): key/value pairs that needs to be provided to the installer.
        Supported keys:
          hosts (list): name of host.
          placement (dict): placement on hosts.
          count (int): number of hosts to be applied
    """
    cmd = f"{self.base_cmd} apply"
    if service_name:
        cmd += f" {service_name}"
    for arg in kw.pop("pos_args"):
        cmd += f" {arg}"
    cmd += build_cmd_from_args(**kw)
    out = self.execute(sudo=True, cmd=cmd, check_ec=check_ec)
    if isinstance(out, tuple):
        return out[0].strip()
    return out