def clean_debian_comma_logic(exp):
    """
    Convert Debian specific logic regarding comma to parsable license expression.
    Example:   `lgpl-3 or gpl-2, and apache-2.0` -> `(lgpl-3 or gpl-2) and apache-2.0`
    """
    subexps = []
    while ', and' in exp:
        exp, and_op, right = exp.rpartition(', and')
        subexps.insert(0, right)
    subexps.insert(0, exp)
    wrapped = [f'({i.strip()})' for i in subexps]
    cleaned = ' and '.join(wrapped)
    return cleaned