input: Write a python function to calculate the spherical distance between two points given their latitude and longitude.
  assert distance(36.12, -86.67, 33.94, -118.40) == 2887.2599506071117
  assert distance(51.5, 0.0, 38.8, -77.1) == 5918.676745979258
  assert distance(0.0, 0.0, 0.0, 0.0) == 0.0
output: import math
  
  def distance(lat1, lon1, lat2, lon2):
      R = 6371.0  # Earth's radius in kilometers
  
      # Convert latitude and longitude from degrees to radians
      lat1_rad = math.radians(lat1)
      lon1_rad = math.radians(lon1)
      lat2_rad = math.radians(lat2)
      lon2_rad = math.radians(lon2)
  
      # Compute differences between points
      dlat = lat2_rad - lat1_rad
      dlon = lon2_rad - lon1_rad
  
      # Haversine formula
      a = math.sin(dlat / 2)**2 + math.cos(lat1_rad) * math.cos(lat2_rad) * math.sin(dlon / 2)**2
      c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
  
      # Distance in kilometers
      distance_km = R * c
  
      return distance_km