def _format_stack(self, stack, current=None):
        """Prettifies a scope stack for use in error messages.

        :param list(str) stack: List of scopes.
        :param str current: The current scope. If specified, will be appended
            onto the stack before formatting.
        :returns: str
        """
        if current is not None:
            stack = stack + [current]
        if len(stack) > 1:
            prefix = os.path.commonprefix(stack)
            if prefix.endswith('/'):
                prefix = prefix[:-1]
            stack = [scope[len(prefix):] for scope in stack]
        return ' => '.join(stack)
Prettifies a scope stack for use in error messages.

        :param list(str) stack: List of scopes.
        :param str current: The current scope. If specified, will be appended
            onto the stack before formatting.
        :returns: str