def parse_pi_data(pi_data):
 results = {}
 for elt in pi_data.split():
  if RE_DOUBLE_QUOTE.match(elt):
   (kwd, val) = RE_DOUBLE_QUOTE.match(elt).groups()
  elif RE_SIMPLE_QUOTE.match(elt):
   (kwd, val) = RE_SIMPLE_QUOTE.match(elt).groups()
  else:
   (kwd, val) = (elt, None)
  results[kwd] = val
 return results

def parse_pi_data ( pi_data ) : results = { } for elt in pi_data . split ( ) : if RE_DOUBLE_QUOTE . match ( elt ) : ( kwd , val ) = RE_DOUBLE_QUOTE . match ( elt ) . groups ( ) elif RE_SIMPLE_QUOTE . match ( elt ) : ( kwd , val ) = RE_SIMPLE_QUOTE . match ( elt ) . groups ( ) else : ( kwd , val ) = ( elt , None ) results [ kwd ] = val return results
utility function that parses the data contained in an xml processing instruction and returns a dictionary of keywords and their associated values .