docs: def distance_matrix(lons, lats, diameter=2*EARTH_RADIUS):
      """
      :param lons: array of m longitudes
      :param lats: array of m latitudes
      :returns: matrix of (m, m) distances
      """
      m = len(lons)
      assert m == len(lats), (m, len(lats))
      lons = numpy.radians(lons)
      lats = numpy.radians(lats)
      cos_lats = numpy.cos(lats)
      result = numpy.zeros((m, m))
      for i in range(len(lons)):
          a = numpy.sin((lats[i] - lats) / 2.0)
          b = numpy.sin((lons[i] - lons) / 2.0)
          result[i, :] = numpy.arcsin(
              numpy.sqrt(a * a + cos_lats[i] * cos_lats * b * b)) * diameter
      return numpy.matrix(result, copy=False)