code: def read_resolv_conf(self, f):
          
          if isinstance(f, basestring):
              try:
                  f = open(f, 'r')
              except IOError:
                  # /etc/resolv.conf doesn't exist, can't be read, etc.
                  # We'll just use the default resolver configuration.
                  self.nameservers = ['127.0.0.1']
                  return
              want_close = True
          else:
              want_close = False
          try:
              for l in f:
                  l = l.strip()
                  if len(l) == 0 or l[0] == '#' or l[0] == ';':
                      continue
                  tokens = l.split()
                  if len(tokens) < 2:
                      continue
                  if tokens[0] == 'nameserver':
                      self.nameservers.append(tokens[1])
                  elif tokens[0] == 'domain':
                      self.domain = dns.name.from_text(tokens[1])
                  elif tokens[0] == 'search':
                      for suffix in tokens[1:]:
                          self.search.add(dns.name.from_text(suffix))
          finally:
              if want_close:
                  f.close()
          if len(self.nameservers) == 0:
              self.nameservers.append('127.0.0.1')
docs: Process f as a file in the /etc/resolv.conf format.  If f is
          a string, it is used as the name of the file to open; otherwise it
          is treated as the file itself.