def list_to_where(field: str, elements: List[str], lower=False) -> Optional[str]:
    if (not elements):
        return None
    if lower:
        elements = [element.lower() for element in elements]
        field = f'LOWER({field})'
    santized = [sanitize(element) for element in elements]
    quoted = [f"'{element}'" for element in santized]
    joined = ', '.join(quoted)
    return f'{field} IN ({joined})'
def list_to_where(field: str, elements: List[str], lower=False) -> Optional[str]:
    if (not elements):
        return None
    if lower:
        elements = [element.lower() for element in elements]
        field = f'LOWER({field})'
    santized = [sanitize(element) for element in elements]
    quoted = [f"'{element}'" for element in santized]
    joined = ', '.join(quoted)
    return f'{field} IN ({joined})'