(path)
Ensure that the given path is decoded,
    NONE when no expected encoding works
Ensure that the given path is decoded,
    NONE when no expected encoding works
Ensure that the given path is decoded NONE when no expected encoding works
def filesys_decode(path):
    """
    Ensure that the given path is decoded,
    NONE when no expected encoding works
    """

    if isinstance(path, six.text_type):
        return path

    fs_enc = sys.getfilesystemencoding() or 'utf-8'
    candidates = fs_enc, 'utf-8'

    for enc in candidates:
        try:
            return path.decode(enc)
        except UnicodeDecodeError:
            continue
def filesys_decode ( path ) : if isinstance ( path , six . text_type ) : return path fs_enc = sys . getfilesystemencoding ( ) or 'utf-8' candidates = fs_enc , 'utf-8' for enc in candidates : try : return path . decode ( enc ) except UnicodeDecodeError : continue