code: def distance(self, x, y):
          
          if scipy.sparse.issparse(x):
              return numpy.linalg.norm((x-y).toarray().ravel())
          else:
              return numpy.linalg.norm(x-y)
docs: Computes distance measure between vectors x and y. Returns float.