def get_sub_data_and_schema(data, schema, id_prefix):
    sub_data = data
    sub_schema = schema
    try:
        for key in id_prefix.split('__'):
            if (sub_schema['type'] == 'array'):
                key = int(key)
                sub_schema = sub_schema['items']
            elif (sub_schema['type'] == 'object'):
                sub_schema = sub_schema['properties'][key]
            else:
                raise ValueError('invalid type')
            if isinstance(key, int):
                while (key >= len(sub_data)):
                    sub_data.append(generate_placeholder(sub_schema))
            elif (key not in sub_data):
                sub_data[key] = generate_placeholder(sub_schema)
            sub_data = sub_data[key]
        if (sub_schema['type'] != 'array'):
            raise ValueError('invalid type')
    except (ValueError, KeyError, IndexError, TypeError):
        raise ValueError('invalid action')
    return (sub_data, sub_schema)
def get_sub_data_and_schema(data, schema, id_prefix):
    sub_data = data
    sub_schema = schema
    try:
        for key in id_prefix.split('__'):
            if (sub_schema['type'] == 'array'):
                key = int(key)
                sub_schema = sub_schema['items']
            elif (sub_schema['type'] == 'object'):
                sub_schema = sub_schema['properties'][key]
            else:
                raise ValueError('invalid type')
            if isinstance(key, int):
                while (key >= len(sub_data)):
                    sub_data.append(generate_placeholder(sub_schema))
            elif (key not in sub_data):
                sub_data[key] = generate_placeholder(sub_schema)
            sub_data = sub_data[key]
        if (sub_schema['type'] != 'array'):
            raise ValueError('invalid type')
    except (ValueError, KeyError, IndexError, TypeError):
        raise ValueError('invalid action')
    return (sub_data, sub_schema)