def get_obj_offset(types, member_list):
 member_list.reverse()
 current_type = member_list.pop()
 offset = 0
 while (len(member_list) > 0):
  if (current_type == 'array'):
   current_type = member_dict[current_member][1][2][0]
   if (current_type in builtin_types):
    current_type_size = builtin_size(current_type)
   else:
    current_type_size = obj_size(types, current_type)
   index = member_list.pop()
   offset += (index * current_type_size)
   continue
  elif (not types.has_key(current_type)):
   raise Exception(('Invalid type ' + current_type))
  member_dict = types[current_type][1]
  current_member = member_list.pop()
  if (not member_dict.has_key(current_member)):
   raise Exception(('Invalid member %s in type %s' % (current_member, current_type)))
  offset += member_dict[current_member][0]
  current_type = member_dict[current_member][1][0]
 return (offset, current_type)

def get_obj_offset ( types , member_list ) : member_list . reverse ( ) current_type = member_list . pop ( ) offset = 0 while ( len ( member_list ) > 0 ) : if ( current_type == 'array' ) : current_type = member_dict [ current_member ] [ 1 ] [ 2 ] [ 0 ] if ( current_type in builtin_types ) : current_type_size = builtin_size ( current_type ) else : current_type_size = obj_size ( types , current_type ) index = member_list . pop ( ) offset += ( index * current_type_size ) continue elif ( not types . has_key ( current_type ) ) : raise Exception ( ( 'Invalid type ' + current_type ) ) member_dict = types [ current_type ] [ 1 ] current_member = member_list . pop ( ) if ( not member_dict . has_key ( current_member ) ) : raise Exception ( ( 'Invalid member %s in type %s' % ( current_member , current_type ) ) ) offset += member_dict [ current_member ] [ 0 ] current_type = member_dict [ current_member ] [ 1 ] [ 0 ] return ( offset , current_type )
returns the pair for a given list .