#NEWLINE# def _serialize( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( not self . ranges ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Invalid ranges' ) #NEWLINE# #UNINDENT# data [ 'ranges' ] = self . ranges #NEWLINE# if self . field : #NEWLINE# #INDENT# data [ 'field' ] = self . field #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . key_field : #NEWLINE# #INDENT# data [ 'key_field' ] = self . key_field #NEWLINE# if self . value_field : #NEWLINE# #INDENT# data [ 'value_field' ] = data . value_field #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'Invalid key_field: value_field required' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if self . key_script : #NEWLINE# #INDENT# data [ 'key_script' ] = self . key_script #NEWLINE# if self . value_script : #NEWLINE# #INDENT# data [ 'value_script' ] = self . value_script #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'Invalid key_script: value_script required' ) #NEWLINE# #UNINDENT# if self . params : #NEWLINE# #INDENT# data [ 'params' ] = self . params #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return data