#NEWLINE# def toarray( v , index_value = False ) : #NEWLINE# #INDENT# '\n    Interface helper function to turn dask Arrays into numpy arrays as\n    necessary. If index_value is True, a value is returned instead of\n    an array holding a single value.\n    ' #NEWLINE# if ( dask and isinstance ( v , dask . array . Array ) ) : #NEWLINE# #INDENT# arr = v . compute ( ) #NEWLINE# return ( arr [ ( ) ] if index_value else arr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return v