code: def fetch(
      url: str,
      name: Optional[Union[pathlib.Path, str]] = None,
      allow_caching=not getenv("DISABLE_HTTP_CACHE"),
  ) -> pathlib.Path:
      if url.startswith(("/", ".")):
          return pathlib.Path(url)
      fp = (
          pathlib.Path(name)
          if name is not None
          and (isinstance(name, pathlib.Path) or "/" in name)
          else pathlib.Path(_cache_dir)
          / "tinygrad"
          / "downloads"
          / (
              name
              if name
              else hashlib.md5(url.encode("utf-8")).hexdigest()
          )
      )  # noqa: E501
      if not fp.is_file() or not allow_caching:
          with request.urlopen(url, timeout=10) as r:
              assert r.status == 200
              total_length = int(r.headers.get("content-length", 0))
              progress_bar = tqdm(
                  total=total_length,
                  unit="B",
                  unit_scale=True,
                  desc=url,
              )
              (path := fp.parent).mkdir(parents=True, exist_ok=True)
              with tempfile.NamedTemporaryFile(
                  dir=path, delete=False
              ) as f:
                  while chunk := r.read(16384):
                      progress_bar.update(f.write(chunk))
                  f.close()
                  if (
                      file_size := os.stat(f.name).st_size
                  ) < total_length:
                      raise RuntimeError(
                          f"fetch size incomplete, {file_size} < {total_length}"
                      )
                  pathlib.Path(f.name).rename(fp)
      return fp
  
imports: from __future__ import annotations
  import os, functools, platform, time, re, contextlib, operator, hashlib, pickle, sqlite3, cProfile, pstats, tempfile, pathlib, string, ctypes
  from urllib import request
  from tqdm import tqdm
  from typing import Dict, Tuple, Union, List, ClassVar, Optional, Iterable, Any, TypeVar, TYPE_CHECKING, Callable, Sequence
label_desc: Use image node_id 29 for calling a global function with example usage: fetch(url, name, allow_caching) and returns: fp, pathlib