code: def nom(txt, off, cset, trim=True):
      '''
      Consume chars in set from the string and return (subtxt,offset).
  
      Example:
  
          text = "foo(bar)"
          chars = set('abcdefghijklmnopqrstuvwxyz')
  
          name,off = nom(text,0,chars)
  
      '''
      if trim:
          while len(txt) > off and txt[off] in whites:
              off += 1
  
      r = ''
      while len(txt) > off and txt[off] in cset:
          r += txt[off]
          off += 1
  
      if trim:
          while len(txt) > off and txt[off] in whites:
              off += 1
  
      return r, off nom(txt, off, cset, trim=True):
      '''
      Consume chars in set from the string and return (subtxt,offset).
  
      Example:
  
          text = "foo(bar)"
          chars = set('abcdefghijklmnopqrstuvwxyz')
  
          name,off = nom(text,0,chars)
  
      '''
      if trim:
          while len(txt) > off and txt[off] in whites:
              off += 1
  
      r = ''
      while len(txt) > off and txt[off] in cset:
          r += txt[off]
          off += 1
  
      if trim:
          while len(txt) > off and txt[off] in whites:
              off += 1
  
      return r, off
docs: Consume chars in set from the string and return (subtxt,offset).
  
      Example:
  
          text = "foo(bar)"
          chars = set('abcdefghijklmnopqrstuvwxyz')
  
          name,off = nom(text,0,chars)