I would be +1 to remove the for loop here https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/pairwise.py#L861 and call the kernel function directly assuming it returns a matrix.