Default validation for Attribute Details data structure

def validate_complex_list(prop, value, xpath_map=None):
    """ Default validation for Attribute Details data structure """

    if value is not None:
        validate_type(prop, value, (dict, list))

        if prop in _complex_definitions:
            complex_keys = _complex_definitions[prop]
        else:
            complex_keys = {} if xpath_map is None else xpath_map

        for idx, complex_struct in enumerate(wrap_value(value)):
            cs_idx = prop + '[' + str(idx) + ']'
            validate_type(cs_idx, complex_struct, dict)

            for cs_prop, cs_val in iteritems(complex_struct):
                cs_key = '.'.join((cs_idx, cs_prop))

                if cs_prop not in complex_keys:
                    _validation_error(prop, None, value, ('keys: {0}'.format(','.join(complex_keys))))

                if not isinstance(cs_val, list):
                    validate_type(cs_key, cs_val, (string_types, list))
                else:
                    for list_idx, list_val in enumerate(cs_val):
                        list_prop = cs_key + '[' + str(list_idx) + ']'
                        validate_type(list_prop, list_val, string_types)