docs: def make_parent_dirs(path, mode=0o777):
    """
    Ensure parent directories of a file are created as needed.
    """
    parent = os.path.dirname(path)
    if parent:
      make_all_dirs(parent, mode)
    return path