def _coerceToFilesystemEncoding(path, newpath, encoding=None):
    """
    Return a C{newpath} that is suitable for joining to C{path}.

    @param path: The path that it should be suitable for joining to.
    @param newpath: The new portion of the path to be coerced if needed.
    @param encoding: If coerced, the encoding that will be used.
    """
    if type(path) == bytes:
        return _asFilesystemBytes(newpath, encoding=encoding)
    else:
        return _asFilesystemText(newpath, encoding=encoding)

    Return a C{newpath} that is suitable for joining to C{path}.

    @param path: The path that it should be suitable for joining to.
    @param newpath: The new portion of the path to be coerced if needed.
    @param encoding: If coerced, the encoding that will be used.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/filepath.py