human
Solve the following python programming problem given the following code:
def pandoc(source, fmt, to, filter_func = None) : 
    'Convert a string in format `from` to format `to` via pandoc.

    This is based on nbconvert.utils.pandoc.pandoc() and extended to
    allow passing a filter function.

    ' 
    def encode(text) : 
        return (text if isinstance (text, bytes) else text.encode ('utf-8')) 
def decode(data) : 
        return (data.decode ('utf-8') if isinstance (data, bytes) else data) 
cmd1 = ['pandoc', '--from', fmt, '--to', 'json'] 
    cmd2 = ['pandoc', '--from', 'json', '--to', cmd1] 
    nbconvert.utils.pandoc.check_pandoc_version () 
    p = subprocess.Popen (cmd1, stdin = subprocess.PIPE, stdout = subprocess.PIPE) 
    (json_data, _) = p.communicate (encode (source)) 
    if filter_func : 
        json_data = encode (filter_func (decode (json_data))) 
p = subprocess.Popen (cmd2, stdin = subprocess.PIPE, stdout = subprocess.PIPE) 
    (out, _) = p.communicate (json_data) 
    return decode (out).rstrip ('
') 

    
    

    Fix the buggy line: cmd2 = ['pandoc', '--from', 'json', '--to', cmd1]
assistant
#Here is Python code to fix the buggy line: cmd2 = ['pandoc', '--from', 'json', '--to', cmd1]
.

cmd2 = ['pandoc', '--from', 'json', '--to', to]