human
Write me a the Python code you requested given the following:
Complete the below
def check_host(fn):

    ''''Makes sure that the host exists.'
    '''
assistant
#Here is the Python code you requested.
    def wrapped(self, req, id, service=None, *args, **kwargs):
        listed_hosts = _list_hosts(req, service)
        hosts = [h['host_name'] for h in listed_hosts]
        if (id in hosts):
            return fn(self, req, id, *args, **kwargs)
        else:
            message = (_("Host    '%s'    could    not    be    found.") % id)
            raise webob.exc.HTTPNotFound(explanation=message)
    return wrapped