from typing import Optional


def bool_query(param: Optional[bool]):
    # if param is boolean, we must return the json variant (e.g. True => true)
    if isinstance(param, bool):
        return str(param).lower()

    return param
