def dbscan_metric(a, b):
    diff = a - b
if a.shape[0] != NUM_FEATURES:
    to_calc = diff
else:
    to_calc = np.multiply(FTR_WEIGHTS, diff)
How to improve the performance of this tiny distance Python function