def _use_reflect_func(opt):
    """
    Return True if the reflect function is to be used.
    """
    if opt.reflect_out == None or opt.reflect_in == None:
        return True
    elif opt.algorithm == opt.algo_table_driven:
        if opt.reflect_in != opt.reflect_out:
            return True
    elif opt.algorithm == opt.algo_bit_by_bit:
        if opt.reflect_in:
            return True
        if opt.reflect_out:
            return True
    elif opt.algorithm == opt.algo_bit_by_bit_fast:
        if opt.reflect_in:
            return True
        if opt.reflect_out:
            return True
    return False
