def is_within_look_behind(kernel, look_ahead):
    """Check if vehicle is within the looking distance

    Parameters
    ----------
    kernel: obj
    Traci API obj to collect current simulation information
    (from flow.kernel in parent class)
        example- kernel.vehicle.get_accel(veh_id)
                returns the acceleration of the vehicle id

    look_ahead: int
        distance for traffic light to look behind and observe vehicles

    Returns
    ----------
    deep_filter: function
        parameterized function to check whether vehicles are within looking distance
    """

    def deep_filter(veh_id):
        """Return bool whether vehicle is in look_ahead distance
        Parameters:
        ----------
        veh_id: string
            string id of vehicle

        Returns:
        --------
        bool: True or False
            whether vehicle is within look behinddistance

        """

        if kernel.vehicle.get_position(veh_id) <= look_ahead:
            return True
        else:
            return False

    return deep_filter