<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _coord2int(lng, lat, dim):
 """Convert lon, lat values into a dim x dim-grid coordinate system. Parameters: lng: float Longitude value of coordinate (-180.0, 180.0); corresponds to X axis lat: float Latitude value of coordinate (-90.0, 90.0); corresponds to Y axis dim: int Number of coding points each x, y value can take. Corresponds to 2^level of the hilbert curve. Returns: Tuple[int, int]: Lower left corner of corresponding dim x dim-grid box x x value of point [0, dim); corresponds to longitude y y value of point [0, dim); corresponds to latitude """

    assert dim >= 1

    lat_y = (lat + _LAT_INTERVAL[1]) / 180.0 * dim   # [0 ... dim)
    lng_x = (lng + _LNG_INTERVAL[1]) / 360.0 * dim  # [0 ... dim)

    return min(dim - 1, int(floor(lng_x))), min(dim - 1, int(floor(lat_y)))