code: def _filename_from_content_disposition(
      content_disposition: str,
  ) -> Optional[str]:
      """Extract the filename from the content disposition.
  
      Parse the content_definition as defined in:
      https://tools.ietf.org/html/rfc2616
  
      Note:
  
       * If both encoded (`filename*=`) and ascii (filename=) name are defined,
         the function returns the ascii name, as encoding might create issue on
         some systems
       * If only the encoded name is defined (e.g.
         `filename*=UTF-8''%e2%82%ac.txt`), the function return None as this is
         not yet supported.
  
      Args:
          content_disposition: String to parse.
  
      Returns:
          filename: The filename, or None if filename could not be parsed
      """
      match = re.findall(
          # Regex (see unittests for examples):
          # ` *` : Strip eventual whitespaces
          # `['"]?` : Filename is optionally wrapped in quote
          # `([^;\r\n"']+)` : Filename can be any symbol except those
          # `;?` : Stop when encountering optional `;`
          r"""filename= *['"]?([^;\r\n"']+)['"]? *;?""",
          content_disposition,
          flags=re.IGNORECASE,
      )
      if not match:
          return None
      elif len(match) != 1:
          raise ValueError(
              f"Error while parsing filename for: {content_disposition}\n"
              f"Multiple filename detected: {list(match)}"
          )
      return os.path.basename(match[0].rstrip())
  
imports: import concurrent.futures
  import contextlib
  import dataclasses
  import functools
  import hashlib
  import io
  import os
  import re
  from typing import Any, ContextManager, Iterable, Iterator, Optional, Tuple, Union
  import urllib
  from etils import epath
  import promise
  import requests
  from tensorflow_datasets.core import units
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.download import checksums
  from tensorflow_datasets.core.download import util
  from tensorflow_datasets.core.utils import tqdm_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: _filename_from_content_disposition(content_disposition) and returns: os, None