def _resolve_queue(self, queue, depth=<NUM_LIT:0>, links=None):
if depth == <NUM_LIT:0>:<EOL><INDENT>logger.debug("<STR_LIT>", queue)<EOL><DEDENT>answer = self.check_output(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % {<EOL>'<STR_LIT>': escape_queue(queue)})<EOL>if answer == b'<STR_LIT>':<EOL><INDENT>if depth > <NUM_LIT:0>:<EOL><INDENT>logger.debug("<STR_LIT>", depth)<EOL><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL><DEDENT>return None, depth<EOL><DEDENT>elif answer.startswith(b'<STR_LIT>'):<EOL><INDENT>version, runtime, path = answer[<NUM_LIT:4>:].split(b'<STR_LIT:\n>', <NUM_LIT:2>)<EOL>try:<EOL><INDENT>version = tuple(int(e)<EOL>for e in version.decode('<STR_LIT:ascii>', '<STR_LIT:ignore>')<EOL>.split('<STR_LIT:.>'))<EOL><DEDENT>except ValueError:<EOL><INDENT>version = <NUM_LIT:0>, <NUM_LIT:0><EOL><DEDENT>if version[:<NUM_LIT:2>] != self.PROTOCOL_VERSION:<EOL><INDENT>raise QueueExists(<EOL>msg="<STR_LIT>"<EOL>"<STR_LIT>" % '<STR_LIT:.>'.join('<STR_LIT:%s>' % e for e in version))<EOL><DEDENT>path = PosixPath(path)<EOL>runtime = runtime.decode('<STR_LIT:ascii>', '<STR_LIT:replace>')<EOL>if self.need_runtime is not None:<EOL><INDENT>if (self.need_runtime is not None and<EOL>runtime not in self.need_runtime):<EOL><INDENT>raise QueueExists(<EOL>msg="<STR_LIT>"<EOL>"<STR_LIT>" % runtime)<EOL><DEDENT><DEDENT>logger.debug("<STR_LIT>",<EOL>path, depth, runtime)<EOL>return path, depth<EOL><DEDENT>elif answer.startswith(b'<STR_LIT>'):<EOL><INDENT>new = queue.parent / answer[<NUM_LIT:8>:]<EOL>logger.debug("<STR_LIT>", new)<EOL>if links is not None:<EOL><INDENT>links.append(queue)<EOL><DEDENT>return self._resolve_queue(new, depth + <NUM_LIT:1>)<EOL><DEDENT>else:  <EOL><INDENT>logger.debug("<STR_LIT>", answer)<EOL>raise RemoteCommandFailure(msg="<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>
Finds the location of tej's queue directory on the server.

        The `queue` set when constructing this `RemoteQueue` might be relative
        to the home directory and might contain ``~user`` placeholders. Also,
        each queue may in fact be a link to another path (a file containing
        the string ``tejdir:``, a space, and a new pathname, relative to this
        link's location).