@classmethod<EOL><INDENT>def resolve_workdir_path(cls, start_path=os.curdir):<DEDENT>
if start_path == '<STR_LIT>':<EOL><INDENT>start_path = os.curdir<EOL><DEDENT>cur_path = start_path<EOL>LOGGER.debug(<EOL>'<STR_LIT>',<EOL>os.path.abspath(cur_path),<EOL>)<EOL>if cls.is_workdir(cur_path):<EOL><INDENT>return os.path.abspath(cur_path)<EOL><DEDENT>cur_path = os.path.join(start_path, '<STR_LIT>')<EOL>while not cls.is_workdir(cur_path):<EOL><INDENT>LOGGER.debug('<STR_LIT>', cur_path)<EOL>cur_path = os.path.normpath(<EOL>os.path.join(cur_path, '<STR_LIT:..>', '<STR_LIT:..>', '<STR_LIT>')<EOL>)<EOL>LOGGER.debug('<STR_LIT>', cur_path)<EOL>if os.path.realpath(os.path.join(cur_path, '<STR_LIT:..>')) == '<STR_LIT:/>':<EOL><INDENT>candidates = []<EOL>for path in os.listdir(os.curdir):<EOL><INDENT>if os.path.isdir(path):<EOL><INDENT>dirs = os.listdir(path)<EOL>if '<STR_LIT>' in dirs:<EOL><INDENT>candidates.append(<EOL>os.path.abspath(os.path.join(os.curdir, path))<EOL>)<EOL><DEDENT>elif '<STR_LIT>' in dirs:<EOL><INDENT>candidates.append(<EOL>os.path.abspath(<EOL>os.path.join(os.curdir, path, '<STR_LIT>')<EOL>)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>candidates = filter(Workdir.is_possible_workdir, candidates)<EOL>for idx in range(len(candidates)):<EOL><INDENT>if os.path.split(candidates[idx])[<NUM_LIT:1>] == '<STR_LIT>':<EOL><INDENT>candidates[idx] = os.path.dirname(candidates[idx])<EOL><DEDENT><DEDENT>msg = '<STR_LIT>'.format(<EOL>os.path.abspath(start_path)<EOL>)<EOL>if candidates:<EOL><INDENT>msg += '<STR_LIT>'.format(<EOL>'<STR_LIT:U+002CU+0020>'.join(candidates)<EOL>)<EOL><DEDENT>raise LagoUserException(msg)<EOL><DEDENT><DEDENT>return os.path.abspath(cur_path)<EOL>
Look for an existing workdir in the given path, in a path/.lago dir,
or in a .lago dir under any of it's parent directories

Args:
    start_path (str): path to start the search from, if None passed, it
        will use the current dir

Returns:
    str: path to the found prefix

Raises:
    LagoUserException: if no prefix was found