def clean_input(text):
    # type: (unicode) -> str
    '''
    Cleans some input text, doing things such as removing smart quotes.
    '''
    # Replaces smart quotes; Shlex crashes if it encounters an unbalanced
    # smart quote, as happens with auto-formatting.
    text = (text.replace(u'\u2018', '\'')
                .replace(u'\u2019', '\'')
                .replace(u'\u201c','"')
                .replace(u'\u201d', '"'))
    # Undo autoformatting of dashes
    text = (text.replace(u'\u2013', '--')
                .replace(u'\u2014', '--'))

    return text.encode('utf-8')
Cleans some input text, doing things such as removing smart quotes.
securitybot/bot.py