def METHOD_NAME(self, nagios_context, hostname):
    for f in os.listdir(NRPE.nagios_exportdir):
        if re.search('.*{}.cfg'.format(self.command), f):
            os.remove(os.path.join(NRPE.nagios_exportdir, f))
    templ_vars = {
        'nagios_hostname': hostname,
        'nagios_servicegroup': nagios_context,
        'description': self.description,
        'shortname': self.shortname,
        'command': self.command,
    }
    nrpe_service_text = Check.service_template.format(**templ_vars)
    nrpe_service_file = '{}/service__{}_{}.cfg'.format(
        NRPE.nagios_exportdir, hostname, self.command)
    with open(nrpe_service_file, 'w') as nrpe_service_config:
        nrpe_service_config.write(str(nrpe_service_text))