def driving_filter(exclude_public_service_vehicle_paths=True):
    """
    Driving filters for different tags (almost) as in OSMnx for 'drive+service'.

    Filter out un-drivable roads, private ways, and
    anything specifying motor=no. also filter out any non-service roads that
    are tagged as providing parking, private, or emergency-access
    services.

    If 'exclude_public_service_vehicle_paths' == False, also paths that are only accessible
    for public transport vehicles are included.

    Applied filters:
        '["area"!~"yes"]["highway"!~"cycleway|footway|path|pedestrian|steps|track|corridor|'
        'elevator|escalator|proposed|construction|bridleway|abandoned|platform|raceway"]'
        '["motor_vehicle"!~"no"]["motorcar"!~"no"]{}'
        '["service"!~"parking|parking_aisle|private|emergency_access"]'

    """
    drive_filter = dict(
        area=["yes"],
        highway=[
            "cycleway",
            "footway",
            "path",
            "pedestrian",
            "steps",
            "track",
            "corridor",
            "elevator",
            "escalator",
            "proposed",
            "construction",
            "bridleway",
            "abandoned",
            "platform",
            "raceway",
        ],
        motor_vehicle=["no"],
        motorcar=["no"],
        service=["parking", "parking_aisle", "private", "emergency_access"],
    )

    if exclude_public_service_vehicle_paths:
        drive_filter["psv"] = ["yes"]

    return drive_filter