def split_token_in_parts(token):
 result = []
 current = []
 for part in (token + (u':',)):
  if (part == u':'):
   if current:
    result.append(tuple(current))
    current = []
  else:
   current.append(part)
 return result

def split_token_in_parts ( token ) : result = [ ] current = [ ] for part in ( token + ( u':' , ) ) : if ( part == u':' ) : if current : result . append ( tuple ( current ) ) current = [ ] else : current . append ( part ) return result
take a token .