code: def genCompleteTypes( compoundSig ):
      
  
      i     = 0
      start = 0
      end   = len(compoundSig)
  
      def find_end( idx, b, e ):
          depth = 1
          while idx < end:
              subc = compoundSig[idx]
              if subc == b:
                  depth += 1
              elif subc == e:
                  depth -= 1
                  if depth == 0:
                      return idx
              idx += 1
      
      while i < end:
          c = compoundSig[i]
          
          if c == '(':
              x = find_end(i+1, '(', ')')
              yield compoundSig[i:x+1]
              i = x
  
          elif c == '{':
              x = find_end(i+1, '{', '}')
              yield compoundSig[i:x+1]
              i = x
  
          elif c == 'a':
              start = i
              g = genCompleteTypes( compoundSig[i+1:] )
              ct = six.next(g)
              i += len(ct)
              yield 'a' + ct
              
          else:
              yield c
          i += 1
docs: Generator function used to iterate over each complete,
      top-level type contained in in a signature. Ex::
        "iii"       => [ 'i', 'i',       'i' ]
        "i(ii)i"    => [ 'i', '(ii)',    'i' ]
        "i(i(ii))i" => [ 'i', '(i(ii))', 'i' ]