code: def _find_directory_upwards(base: str, target: str) -> Optional[str]:
      
      while True:
          step = os.path.join(base, target)
          LOG.debug("Trying with: `%s`", step)
          if os.path.isdir(step):
              return step
          parent_directory = os.path.dirname(base)
          if parent_directory == base:
              # We have reached the root.
              break
          base = parent_directory
      return None
docs: Walk directories upwards from base, until the root directory is
      reached. At each step, check if the target directory exist, and return
      it if found. Return None if the search is unsuccessful.