def clean_line(line):
    """Remove comments and parentheses from the input line."""
    comment_begin = line.find('#')
    line = line[:comment_begin]
    line = line.replace('[', '').replace(']', '')
    line = line.replace('(', '').replace(')', '')
    return line
