def parse_environ_block(data):
 ret = {}
 pos = 0
 WINDOWS_ = WINDOWS
 while True:
  next_pos = data.find('\x00', pos)
  if (next_pos <= pos):
   break
  equal_pos = data.find('=', pos, next_pos)
  if (equal_pos > pos):
   key = data[pos:equal_pos]
   value = data[(equal_pos + 1):next_pos]
   if WINDOWS_:
    key = key.upper()
   ret[key] = value
  pos = (next_pos + 1)
 return ret

def parse_environ_block ( data ) : ret = { } pos = 0 WINDOWS_ = WINDOWS while True : next_pos = data . find ( '\x00' , pos ) if ( next_pos <= pos ) : break equal_pos = data . find ( '=' , pos , next_pos ) if ( equal_pos > pos ) : key = data [ pos : equal_pos ] value = data [ ( equal_pos + 1 ) : next_pos ] if WINDOWS_ : key = key . upper ( ) ret [ key ] = value pos = ( next_pos + 1 ) return ret
parse a c environ block of environment variables into a dictionary .