(attributes, prefix='')
return result
Convert the attributes from v4 to v3
    Receives a dict and return a dictionary
Convert the attributes from v4 to v3
    Receives a dict and return a dictionary
Convert the attributes from v4 to v3 Receives a dict and return a dictionary
def convert_to_v3_structure(attributes, prefix=''):
    """ Convert the attributes from v4 to v3
    Receives a dict and return a dictionary """
    result = {}
    if isinstance(attributes, str):
        # In the case when we receive a string (e.g. values for security_groups)
        return {'{}{}'.format(prefix, random.randint(1,10**10)): attributes}
    for key, value in attributes.items():
        if isinstance(value, list):
            if len(value):
                result['{}{}.#'.format(prefix, key, hash)] = len(value)
            for i, v in enumerate(value):
                result.update(convert_to_v3_structure(v, '{}{}.{}.'.format(prefix, key, i)))
        elif isinstance(value, dict):
            result['{}{}.%'.format(prefix, key)] = len(value)
            for k, v in value.items():
                result['{}{}.{}'.format(prefix, key, k)] = v
        else:
            result['{}{}'.format(prefix, key)] = value
    return result
def convert_to_v3_structure ( attributes , prefix = '' ) : result = { } if isinstance ( attributes , str ) : # In the case when we receive a string (e.g. values for security_groups) return { '{}{}' . format ( prefix , random . randint ( 1 , 10 ** 10 ) ) : attributes } for key , value in attributes . items ( ) : if isinstance ( value , list ) : if len ( value ) : result [ '{}{}.#' . format ( prefix , key , hash ) ] = len ( value ) for i , v in enumerate ( value ) : result . update ( convert_to_v3_structure ( v , '{}{}.{}.' . format ( prefix , key , i ) ) ) elif isinstance ( value , dict ) : result [ '{}{}.%' . format ( prefix , key ) ] = len ( value ) for k , v in value . items ( ) : result [ '{}{}.{}' . format ( prefix , key , k ) ] = v else : result [ '{}{}' . format ( prefix , key ) ] = value return result