code: def get_nearest_by_numeric_key(data: dict, key: int) -> Any:
      
      return data.get(key, data[min(data.keys(), key=lambda k: abs(k - key))])
docs: Return the dict element whose numeric key is closest to a target.