import math


def distance(orig, dest):
  """Calculate the distance between 2 coordinates"""
  radius = 6371  # Earth radius in meters
  lat1, lon1 = orig
  lat2, lon2 = dest
  haversine = lambda x: math.sin(x / 2) ** 2

  dphi = math.radians(lat2 - lat1)
  dlambda = math.radians(lon2 - lon1)
  phi1, phi2 = math.radians(lat1), math.radians(lat2)

  axr = haversine(dphi) + math.cos(phi1) * math.cos(phi2) * haversine(dlambda)
  return 2 * radius * math.atan2(math.sqrt(axr), math.sqrt(1 - axr))