'Helper routine that returns a boolean indicating whether the number of
parameters is correct for the lookup type.'

def num_params(self, lookup_type, num_param):

    def exactly_two(np):
        return (np == 2)
    def two_to_three(np):
        return ((np >= 2) and (np <= 3))
    if ((lookup_type in self.distance_functions) and (lookup_type != 'dwithin')):
        return two_to_three(num_param)
    else:
        return exactly_two(num_param)
