Check driver on

def validate_driver(f):
    """Check driver on"""

    def check_driver(request):
        drivers = get_all_driver()
        drivers = filter(drivers, request)

        if drivers:
            return f(request, drivers)
        else:
            raise Exception('Driver is not found')

    return check_driver