#NEWLINE# def convert_volume_binds( binds ) : #NEWLINE# #INDENT# if isinstance ( binds , list ) : #NEWLINE# #INDENT# return binds #NEWLINE# #UNINDENT# result = [ ] #NEWLINE# for ( k , v ) in binds . items ( ) : #NEWLINE# #INDENT# if isinstance ( k , six . binary_type ) : #NEWLINE# #INDENT# k = k . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# if isinstance ( v , dict ) : #NEWLINE# #INDENT# if ( ( 'ro' in v ) and ( 'mode' in v ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Binding cannot contain both "ro" and "mode": {}' . format ( repr ( v ) ) ) #NEWLINE# #UNINDENT# bind = v [ 'bind' ] #NEWLINE# if isinstance ( bind , six . binary_type ) : #NEWLINE# #INDENT# bind = bind . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# if ( 'ro' in v ) : #NEWLINE# #INDENT# mode = ( 'ro' if v [ 'ro' ] else 'rw' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'mode' in v ) : #NEWLINE# #INDENT# mode = v [ 'mode' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mode = 'rw' #NEWLINE# #UNINDENT# #UNINDENT# result . append ( six . text_type ( '{0}:{1}:{2}' ) . format ( k , binds , mode ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( v , six . binary_type ) : #NEWLINE# #INDENT# v = v . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# result . append ( six . text_type ( '{0}:{1}:rw' ) . format ( k , v ) ) #NEWLINE# #UNINDENT# #UNINDENT# return result