'Verify value of variable |name| is a valid hostname.
Args:
name [string]: variable name.
required [bool]: If True, the value of variable |name| cannot be empty.'

def verify_host(self, name, required):

    try:
        value = self.__bindings.get(name)
    except KeyError:
        if (not required):
            return True
        self.__errors.append('Missing    "{name}".'.format(name=name))
        return False
    if self.is_reference(value):
        if (not required):
            return True
        self.__errors.append('Missing    "{name}".'.format(name=name))
        return False
    host_token = _host_regex_token()
    host_regex = '^({host})$'.format(host=host_token)
    if (not value):
        if (not required):
            return True
        else:
            self.__errors.append('No    host    provided    for    "{name}".'.format(name=name))
            return False
    if re.match(host_regex, value):
        return True
    self.__errors.append('name="{value}"    does    not    look    like    {regex}'.format(value=value, regex=host_regex))
    return False
