code: def from_text(text, origin = root):
      
  
      if not isinstance(text, str):
          if isinstance(text, unicode) and sys.hexversion >= 0x02030000:
              return from_unicode(text, origin)
          else:
              raise ValueError("input to from_text() must be a string")
      if not (origin is None or isinstance(origin, Name)):
          raise ValueError("origin must be a Name or None")
      labels = []
      label = ''
      escaping = False
      edigits = 0
      total = 0
      if text == '@':
          text = ''
      if text:
          if text == '.':
              return Name([''])
          for c in text:
              if escaping:
                  if edigits == 0:
                      if c.isdigit():
                          total = int(c)
                          edigits += 1
                      else:
                          label += c
                          escaping = False
                  else:
                      if not c.isdigit():
                          raise BadEscape
                      total *= 10
                      total += int(c)
                      edigits += 1
                      if edigits == 3:
                          escaping = False
                          label += chr(total)
              elif c == '.':
                  if len(label) == 0:
                      raise EmptyLabel
                  labels.append(label)
                  label = ''
              elif c == '\\':
                  escaping = True
                  edigits = 0
                  total = 0
              else:
                  label += c
          if escaping:
              raise BadEscape
          if len(label) > 0:
              labels.append(label)
          else:
              labels.append('')
      if (len(labels) == 0 or labels[-1] != '') and not origin is None:
          labels.extend(list(origin.labels))
      return Name(labels)
docs: Convert text into a Name object.
      @rtype: dns.name.Name object