#NEWLINE# def Distance( * args , **kwargs ) : #NEWLINE# #INDENT# total = 0.0 #NEWLINE# last = None #NEWLINE# if ( ( len ( args ) == 1 ) and isinstance ( args , ( list , tuple ) ) ) : #NEWLINE# #INDENT# args = args [ 0 ] #NEWLINE# #UNINDENT# if ( len ( args ) <= 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'Distance needs at least two locations' ) #NEWLINE# #UNINDENT# for location in args : #NEWLINE# #INDENT# if last : #NEWLINE# #INDENT# distance = haversine ( Location ( last ) , Location ( location ) , ** kwargs ) #NEWLINE# if distance : #NEWLINE# #INDENT# total += distance #NEWLINE# #UNINDENT# #UNINDENT# last = location #NEWLINE# #UNINDENT# return total