def str_to_raw(str):
    """Convert string received from commandline to raw (unescaping the string)"""
    try:  # Python 2
        return str.decode('string_escape')
    except:  # Python 3
        return str.encode().decode('unicode_escape')