code: def _hn2db(self, hn):
          '''
          This will add a hostname for a hostname for an included domain or return an existing entry
          '''
          db = self.hn_db
          hn_found = False
          for k,v in db.items():
              if v == hn:  #the hostname is in the database
                  ret_hn = k
                  hn_found = True
          if hn_found:
              return ret_hn
          else:
              self.hostname_count += 1    #we have a new hostname, so we increment the counter to get the host ID number
              o_domain = self.root_domain
              for od,d in self.dn_db.items():
                  if d in hn:
                      o_domain = od
              new_hn = "host%s.%s" % (self.hostname_count, o_domain)
              self.hn_db[new_hn] = hn
  
              return new_hf _hn2db(self, hn):
          '''
          This will add a hostname for a hostname for an included domain or return an existing entry
          '''
          db = self.hn_db
          hn_found = False
          for k,v in db.items():
              if v == hn:  #the hostname is in the database
                  ret_hn = k
                  hn_found = True
          if hn_found:
              return ret_hn
          else:
              self.hostname_count += 1    #we have a new hostname, so we increment the counter to get the host ID number
              o_domain = self.root_domain
              for od,d in self.dn_db.items():
                  if d in hn:
                      o_domain = od
              new_hn = "host%s.%s" % (self.hostname_count, o_domain)
              self.hn_db[new_hn] = hn
  
              return new_hn
docs: This will add a hostname for a hostname for an included domain or return an existing entry