def calculate_slope(p1, p2):
    """
    Calculate the slope of a line segment.
    Args:
        p1: point 1
        p2: point 2

    Returns:

    """
    # Handle the case of a vertical line segment
    if p1[0] == p2[0]:
        return float('inf')
    else:
        return (p2[1] - p1[1]) / (p2[0] - p1[0])

    Calculate the slope of a line segment.
    Args:
        p1: point 1
        p2: point 2

    Returns:

    
metadrive/utils/shapely_utils/geom.py