def parse_colon_dict(data):
 result = {}
 key = None
 for line in data.splitlines():
  parts = [value.strip() for value in line.split(':', 1)]
  if (len(parts) == 2):
   (key, val) = parts
   result[key] = val
  else:
   result.setdefault(key, '')
   result[key] += parts[0]
 return result

def parse_colon_dict ( data ) : result = { } key = None for line in data . splitlines ( ) : parts = [ value . strip ( ) for value in line . split ( ':' , 1 ) ] if ( len ( parts ) == 2 ) : ( key , val ) = parts result [ key ] = val else : result . setdefault ( key , '' ) result [ key ] += parts [ 0 ] return result
parse colon seperated values into a dictionary .