def _getPathAsSameTypeAs(self, pattern):
        """
        If C{pattern} is C{bytes}, return L{FilePath.path} as L{bytes}.
        Otherwise, return L{FilePath.path} as L{unicode}.

        @param pattern: The new element of the path that L{FilePath.path} may
            need to be coerced to match.
        """
        if type(pattern) == bytes:
            return self._asBytesPath()
        else:
            return self._asTextPath()

        If C{pattern} is C{bytes}, return L{FilePath.path} as L{bytes}.
        Otherwise, return L{FilePath.path} as L{unicode}.

        @param pattern: The new element of the path that L{FilePath.path} may
            need to be coerced to match.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/filepath.py