docs: def ensure_dir(path):
          """
          Tries to create directory, if fails, checks if path already exists
          """
          try:
              makedirs(path)
          except OSError as e:  # pragma: no cover
              if e.errno == errno.EEXIST and isdir(path):
                  return (True, 'exists')
              else:
                  return (False, e)
          return (True, path)